X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/f62ba0aeff590ef1c57669d4f46e43b5ee169522..e5198f5d7a60e57a529cf49a96fbb82bc6d8877b:/src/common/xml.ts diff --git a/src/common/xml.ts b/src/common/xml.ts index 3c6feb5d..e7db3aca 100644 --- a/src/common/xml.ts +++ b/src/common/xml.ts @@ -2,9 +2,19 @@ // // SPDX-License-Identifier: AGPL-3.0 -export const getTagValue = (document: Document | Element, tagName: string, defaultValue: string) => { +import { customDecodeURI } from "./url"; + +export const getTagValue = (document: Document | Element, tagName: string, defaultValue: string, skipDecoding: boolean = false) => { const [el] = Array.from(document.getElementsByTagName(tagName)); - return decodeURI(el ? htmlDecode(el.innerHTML) : defaultValue); + const URI = el ? htmlDecode(el.innerHTML) : defaultValue; + + if (!skipDecoding) { + try { + return customDecodeURI(URI); + } catch(e) {} + } + + return URI; }; const htmlDecode = (input: string) => {