X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f0a64666816383d2641d5fa7ea22019441ac4464..8297f0f273e326e64145a48266805b0b3d073c32:/src/common/url.ts diff --git a/src/common/url.ts b/src/common/url.ts index 9789b65e..0d2549c1 100644 --- a/src/common/url.ts +++ b/src/common/url.ts @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + export function getUrlParameter(search: string, name: string) { const safeName = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); const regex = new RegExp('[\\?&]' + safeName + '=([^&#]*)'); @@ -13,3 +17,15 @@ export function normalizeURLPath(url: string) { } return u.toString(); } + +export const customEncodeURI = (path: string) => { + return encodeURIComponent(path.replace(/%2F/g, '/')); +}; + +export const customDecodeURI = (path: string) => { + return decodeURIComponent(path.replace(/\//g, '%2F')); +}; + +export const encodeHash = (path: string) => { + return path.replace(/#/g, '%23'); +}; \ No newline at end of file