Skip to content
Snippets Groups Projects
Unverified Commit a3cdb4cc authored by tamaina's avatar tamaina Committed by GitHub
Browse files

fix: Handle decodeURIComponent error (#8411)

parent e6f455a9
No related branches found
No related tags found
No related merge requests found
......@@ -49,14 +49,22 @@ export default defineComponent({
}, {}, 'closed');
});
function safeURIDecode(str: string) {
try {
return decodeURIComponent(str);
} catch {
return str;
}
}
return {
local,
schema: url.protocol,
hostname: decodePunycode(url.hostname),
port: url.port,
pathname: decodeURIComponent(url.pathname),
query: decodeURIComponent(url.search),
hash: decodeURIComponent(url.hash),
pathname: safeURIDecode(url.pathname),
query: safeURIDecode(url.search),
hash: safeURIDecode(url.hash),
self: self,
attr: self ? 'to' : 'href',
target: self ? null : '_blank',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment