From 7677f1ea2a22cae5ba7031ff018f127eae1199b1 Mon Sep 17 00:00:00 2001 From: PiEgg Date: Wed, 19 Oct 2022 17:40:04 +0800 Subject: [PATCH] :bug: Fix: change decodeURI -> decodeURIComponent & encode also --- src/universal/utils/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/universal/utils/common.ts b/src/universal/utils/common.ts index 357b0a393..78d59fdb2 100644 --- a/src/universal/utils/common.ts +++ b/src/universal/utils/common.ts @@ -2,7 +2,7 @@ export const isUrl = (url: string): boolean => (url.startsWith('http://') || url export const isUrlEncode = (url: string): boolean => { url = url || '' try { - return url !== decodeURI(url) + return url !== decodeURIComponent(url) } catch (e) { // if some error caught, try to let it go return true @@ -11,7 +11,7 @@ export const isUrlEncode = (url: string): boolean => { export const handleUrlEncode = (url: string): string => { if (!isUrlEncode(url)) { - url = encodeURI(url) + url = encodeURIComponent(url) } return url }