Merge branch '19177-sharing-urls-ui-config'. Closes #19177
[arvados-workbench2.git] / src / common / url.ts
index 185737cac331d2a6a5eece01e8f99f293f76c230..db12cb8ea8805a86c14e057e957e3d513cc00acc 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 export function getUrlParameter(search: string, name: string) {
-    const safeName = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
+    const safeName = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
     const regex = new RegExp('[\\?&]' + safeName + '=([^&#]*)');
     const results = regex.exec(search);
     return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
@@ -13,7 +13,7 @@ export function normalizeURLPath(url: string) {
     const u = new URL(url);
     u.pathname = u.pathname.replace(/\/\//, '/');
     if (u.pathname[u.pathname.length - 1] === '/') {
-        u.pathname = u.pathname.substr(0, u.pathname.length - 1);
+        u.pathname = u.pathname.substring(0, u.pathname.length - 1);
     }
     return u.toString();
 }