17426: Add plugin ability to modify +New and account menu
[arvados-workbench2.git] / src / common / url.ts
index 0d2549c1b9fc55cb6b123833ab30e29d4e3aa083..185737cac331d2a6a5eece01e8f99f293f76c230 100644 (file)
@@ -19,13 +19,17 @@ export function normalizeURLPath(url: string) {
 }
 
 export const customEncodeURI = (path: string) => {
-    return encodeURIComponent(path.replace(/%2F/g, '/'));
+    try {
+        return path.split('/').map(encodeURIComponent).join('/');
+    } catch(e) {}
+
+    return path;
 };
 
 export const customDecodeURI = (path: string) => {
-    return decodeURIComponent(path.replace(/\//g, '%2F'));
-};
+    try {
+        return path.split('%2F').map(decodeURIComponent).join('%2F');
+    } catch(e) {}
 
-export const encodeHash = (path: string) => {
-    return path.replace(/#/g, '%23');
-};
\ No newline at end of file
+    return path;
+};