1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Minor refactoring to make function purpose clearer

This commit is contained in:
Laurent Cozic
2018-02-21 18:36:29 +00:00
parent 4a56c76901
commit b9db747b5c
3 changed files with 14 additions and 5 deletions

View File

@ -29,7 +29,15 @@ class WebDavApi {
authToken() {
if (!this.options_.username() || !this.options_.password()) return null;
return base64.encode(this.options_.username() + ':' + this.options_.password());
try {
// Note: Non-ASCII passwords will throw an error about Latin1 characters - https://github.com/laurent22/joplin/issues/246
// Tried various things like the below, but it didn't work on React Native:
//return base64.encode(utf8.encode(this.options_.username() + ':' + this.options_.password()));
return base64.encode(this.options_.username() + ':' + this.options_.password());
} catch (error) {
error.message = 'Cannot encode username/password: ' + error.message;
throw error;
}
}
baseUrl() {