mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-11 17:50:29 +03:00
fix crash when decoding malformed urls (#1865)
This commit is contained in:
parent
8ed78d48fb
commit
581211f13e
5 changed files with 20 additions and 8 deletions
|
|
@ -196,3 +196,11 @@ export const setFavicon = (url: string): void => {
|
|||
if (!favicon) return;
|
||||
favicon.setAttribute('href', url);
|
||||
};
|
||||
|
||||
export const tryDecodeURIComponent = (encodedURIComponent: string): string => {
|
||||
try {
|
||||
return decodeURIComponent(encodedURIComponent);
|
||||
} catch {
|
||||
return encodedURIComponent;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue