🚑 UrlEncore of password to prevent URI malformed error, Possible fix for #32

This commit is contained in:
Sebastien Clement 2020-11-17 21:47:47 +01:00
parent 830f8d6fd5
commit a0ff15d716

View File

@ -211,15 +211,15 @@ class WebdavTools {
let options = { let options = {
body: stream, body: stream,
username: this.username, username: this.username,
password: this.password, password: encodeURI(this.password),
}; };
if (conf.ssl === "true") { if (conf.ssl === "true") {
options["https"] = { rejectUnauthorized: conf.self_signed === "false" }; options["https"] = { rejectUnauthorized: conf.self_signed === "false" };
} }
logger.debug(`...URI: ${this.baseUrl + encodeURI(path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`); logger.debug(`...URI: ${encodeURI(this.baseUrl + path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
got.stream got.stream
.put(this.baseUrl + encodeURI(path), options) .put(encodeURI(this.baseUrl + path), options)
.on("uploadProgress", (e) => { .on("uploadProgress", (e) => {
let percent = e.percent; let percent = e.percent;
if (status.progress != percent) { if (status.progress != percent) {
@ -311,9 +311,9 @@ class WebdavTools {
if (conf.ssl === "true") { if (conf.ssl === "true") {
options["https"] = { rejectUnauthorized: conf.self_signed === "false" }; options["https"] = { rejectUnauthorized: conf.self_signed === "false" };
} }
logger.debug(`...URI: ${this.baseUrl + encodeURI(path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`) logger.debug(`...URI: ${encodeURI(this.baseUrl + path)} rejectUnauthorized: ${options["https"]["rejectUnauthorized"]}`);
pipeline( pipeline(
got.stream.get(this.baseUrl + encodeURI(path), options).on("downloadProgress", (e) => { got.stream.get(encodeURI(this.baseUrl + path), options).on("downloadProgress", (e) => {
let percent = Math.round(e.percent * 100) / 100; let percent = Math.round(e.percent * 100) / 100;
if (status.progress != percent) { if (status.progress != percent) {
status.progress = percent; status.progress = percent;