-
-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: should not replace literal +
with a space in the query string
#960
base: main
Are you sure you want to change the base?
Conversation
+
with
in the query string+
with a space in the query string
src/compose.ts
Outdated
if(memory === -1) temp = url.slice(start).replace(/\\+|%20/g, ' ') | ||
else temp = url.slice(start, memory).replace(/\\+|%20/g, ' ') | ||
if(memory === -1) temp = url.slice(start) | ||
else temp = url.slice(start, memory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to replace %20
with space because we are already calling decodeURIComponent
earlier.
src/compose.ts
Outdated
@@ -694,7 +692,7 @@ export const composeHandler = ({ | |||
}` | |||
} else { | |||
fnLiteral += `if(c.qi !== -1) { | |||
let url = '&' + decodeURIComponent(c.url.slice(c.qi + 1)) | |||
let url = '&' + decodeURIComponent(c.url.slice(c.qi + 1).replaceAll('+', ' ')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should replace +
with a space before calling decodeURIComponent
.
Otherwise, we won't know whether a +
comes from a space (and we want to replace it with space) or comes from a %2B
(and we want to keep it).
0d8db6e
to
06858c2
Compare
06858c2
to
36e2b83
Compare
This PR fixes #943, in which a literal
+
from the query string is replaced with a space.