mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
fix: Handle decodeURIComponent error (#8411)
This commit is contained in:
parent
8f912d25d7
commit
56150d66ef
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user