diff --git a/src/compose.ts b/src/compose.ts index d1eac38d..17302164 100644 --- a/src/compose.ts +++ b/src/compose.ts @@ -898,12 +898,12 @@ export const composeHandler = ({ `if(a${index}===undefined)` + `a${index}=[]\n` + `if(memory===-1){` + - `const temp=decodeURIComponent(url.slice(start)).replace(/\\+/g,' ')\n` + + `const temp=decodeURIComponent(url.slice(start))\n` + `if(temp.includes(',')){a${index}=a${index}.concat(temp.split(','))}` + - `else{a${index}.push(decodeURIComponent(url.slice(start)).replace(/\\+/g,' '))}\n` + + `else{a${index}.push(decodeURIComponent(url.slice(start)))}\n` + `break` + `}else{` + - `const temp=decodeURIComponent(url.slice(start, memory)).replace(/\\+/g,' ')\n` + + `const temp=decodeURIComponent(url.slice(start, memory))\n` + `if(temp.includes(',')){a${index}=a${index}.concat(temp.split(','))}` + `else{a${index}.push(temp)}\n` + `}` + diff --git a/src/deuri.ts b/src/deuri.ts index 1741620c..2b4b4985 100644 --- a/src/deuri.ts +++ b/src/deuri.ts @@ -115,6 +115,9 @@ export const decode = (url: string): string | null => { let percentPosition = url.indexOf('%') if (percentPosition === -1) return url + // Ensure that not encoded plus signs are replaced with spaces + url = url.replace(/\+/g, ' ') + // Ensure percentPosition always has 2 chars after let end = url.length - 3 if (percentPosition > end) return null