17337: Added % sign handling in collection files
[arvados-workbench2.git] / src / common / url.ts
index 0d2549c1b9fc55cb6b123833ab30e29d4e3aa083..7a9a5158a6ad8a184b2d23ef87a8a7c709e8ba76 100644 (file)
@@ -19,11 +19,19 @@ export function normalizeURLPath(url: string) {
 }
 
 export const customEncodeURI = (path: string) => {
-    return encodeURIComponent(path.replace(/%2F/g, '/'));
+    try {
+        return encodeURIComponent(path).replace(/%2F/g, '/');
+    } catch(e) {}
+
+    return path;
 };
 
 export const customDecodeURI = (path: string) => {
-    return decodeURIComponent(path.replace(/\//g, '%2F'));
+    try {
+        return decodeURIComponent(path.replace(/\//g, '%2F'));
+    } catch(e) {}
+
+    return path;
 };
 
 export const encodeHash = (path: string) => {