diff --git a/packages/lib/WebDavApi.js b/packages/lib/WebDavApi.js index a3c9ca161..7bc9cd5cf 100644 --- a/packages/lib/WebDavApi.js +++ b/packages/lib/WebDavApi.js @@ -6,7 +6,7 @@ const URL = require('url-parse'); const { _ } = require('./locale'); const { rtrimSlashes } = require('./path-utils'); const base64 = require('base-64'); - +const { ltrimSlashes } = require('./path-utils'); // Note that the d: namespace (the DAV namespace) is specific to Nextcloud. The RFC for example uses "D:" however // we make all the tags and attributes lowercase so we handle both the Nextcloud style and RFC. Hopefully other @@ -378,7 +378,7 @@ class WebDavApi { if (options.path) fetchOptions.path = options.path; if (body) fetchOptions.body = body; fetchOptions.ignoreTlsErrors = this.options_.ignoreTlsErrors(); - const url = `${this.baseUrl()}/${path}`; + const url = `${this.baseUrl()}/${ltrimSlashes(path)}`; if (shim.httpAgent(url)) fetchOptions.agent = shim.httpAgent(url);