From 619aa8068714a92c315402a953473faf3fe6698e Mon Sep 17 00:00:00 2001 From: Sebastien Clement Date: Tue, 17 Nov 2020 23:28:04 +0100 Subject: [PATCH] :ambulance: Manually buid basic auth header to prevent encoding issue with password #32 --- .../rootfs/opt/nextcloud_backup/tools/webdavTools.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nextcloud_backup/rootfs/opt/nextcloud_backup/tools/webdavTools.js b/nextcloud_backup/rootfs/opt/nextcloud_backup/tools/webdavTools.js index 7c0c708..a9074cd 100644 --- a/nextcloud_backup/rootfs/opt/nextcloud_backup/tools/webdavTools.js +++ b/nextcloud_backup/rootfs/opt/nextcloud_backup/tools/webdavTools.js @@ -212,8 +212,11 @@ class WebdavTools { let conf = this.getConf(); let options = { body: stream, - username: this.username, - password: encodeURIComponent(this.password), + // username: this.username, + // password: encodeURIComponent(this.password), + headers: { + 'Authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64') + } }; if (conf.ssl === "true") { options["https"] = { rejectUnauthorized: conf.self_signed === "false" }; @@ -308,8 +311,9 @@ class WebdavTools { let stream = fs.createWriteStream(tmpFile); let conf = this.getConf(); let options = { - username: this.username, - password: encodeURIComponent(this.password), + headers: { + 'Authorization': 'Basic ' + Buffer.from(this.username + ':' + this.password).toString('base64') + } }; if (conf.ssl === "true") { options["https"] = { rejectUnauthorized: conf.self_signed === "false" };