Skip to content
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

Simplify parseQueryString #8877

Merged
merged 2 commits into from Apr 21, 2017

Conversation

jridgewell
Copy link
Contributor

And it's faster.

let match;
while ((match = regex.exec(queryString))) {
const name = decodeURIComponent(match[1]).trim();
const value = match[2] ? decodeURIComponent(match[2]).trim() : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized that trimming the result of decode is probably a wrong thing :( Maybe we should do it in a separate PR, but x=value%20 should probably preserve a space in the value? Trimming pre-decoded strings is certainly fine...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kinda of the opinion we shouldn't trim at all. We can definitely discuss this in a separate PR, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I'm leaning toward that as well. Not trimming is better than trimming in this case.

Copy link
Contributor

@dvoytenko dvoytenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/one question

@jridgewell jridgewell merged commit 85a527d into ampproject:master Apr 21, 2017
@jridgewell jridgewell deleted the simplify-parseQueryString branch April 21, 2017 19:37
DarXector pushed a commit to DarXector/amphtml that referenced this pull request Apr 25, 2017
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
KenneyE pushed a commit to spotxchange/amphtml that referenced this pull request May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants