17337: Added another edge case handling
[arvados-workbench2.git] / src / common / webdav.ts
index b51cff30703ea51b392b87a2998f9607f052c5a3..8d071fa635ce2f0dc58085e447f981191d96e8a7 100644 (file)
@@ -2,6 +2,8 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { customEncodeURI, encodeHash } from "./url";
+
 export class WebDAV {
 
     defaults: WebDAVDefaults = {
@@ -75,7 +77,12 @@ export class WebDAV {
             r.open(config.method,
                 `${this.defaults.baseURL
                     ? this.defaults.baseURL+'/'
-                    : ''}${config.url}`);
+                    : ''}${customEncodeURI(config.url)}`);
+
+            if (config.headers && config.headers.Destination) {
+                config.headers.Destination = encodeHash(config.headers.Destination);
+            }
+
             const headers = { ...this.defaults.headers, ...config.headers };
             Object
                 .keys(headers)