mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-01 18:27:29 +00:00
fix: Handle decodeURIComponent error (#8411)
This commit is contained in:
parent
e6f455a9bb
commit
a3cdb4cca1
1 changed files with 11 additions and 3 deletions
|
@ -49,14 +49,22 @@ export default defineComponent({
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function safeURIDecode(str: string) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local,
|
local,
|
||||||
schema: url.protocol,
|
schema: url.protocol,
|
||||||
hostname: decodePunycode(url.hostname),
|
hostname: decodePunycode(url.hostname),
|
||||||
port: url.port,
|
port: url.port,
|
||||||
pathname: decodeURIComponent(url.pathname),
|
pathname: safeURIDecode(url.pathname),
|
||||||
query: decodeURIComponent(url.search),
|
query: safeURIDecode(url.search),
|
||||||
hash: decodeURIComponent(url.hash),
|
hash: safeURIDecode(url.hash),
|
||||||
self: self,
|
self: self,
|
||||||
attr: self ? 'to' : 'href',
|
attr: self ? 'to' : 'href',
|
||||||
target: self ? null : '_blank',
|
target: self ? null : '_blank',
|
||||||
|
|
Loading…
Reference in a new issue