Skip to content

Commit

Permalink
🐛 Fix: change decodeURI -> decodeURIComponent & encode also
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Oct 19, 2022
1 parent 3c01861 commit 7677f1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/universal/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 7677f1e

Please sign in to comment.