try a different approach to #277

This commit is contained in:
Aine
2025-01-17 10:38:40 +02:00
parent df911c9e97
commit 0baf6ad94d
4 changed files with 22 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
/**
* Decode a URI component, and if it fails, return the original string.
* @param str The string to decode.
* @returns The decoded string, or the original string if decoding fails.
* @example decodeURIComponent("Hello%20World") // "Hello World"
*/
const decodeURLComponent = (str: any): any => {
try {
return decodeURIComponent(str);
} catch (e) {
return str;
}
}
export default decodeURLComponent;