Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Avoid erroring when getQueryArgs processes a malformed URL #45561
Avoid erroring when getQueryArgs processes a malformed URL #45561
Changes from 2 commits
a85e3d9
4669991
f311dcb
3550425
8a3d7b0
cbb9a3d
9a803c1
e5b754b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
PHP's
parse_str()
returns the malformed query var:getQueryArgs()
was originally designed to emulateparse_str()
(#20693). Would it be possible to return the malformed value instead, for consistent behavior?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.
Thanks, @danielbachhuber for pointing this out. I wasn't familiar with that.
I did the changes as requested.
Please note, that although this is a step to the right direction, will minimally affect the issue we have in calypso.
Calypso uses two ways to parse URLs:
qs
libraryThis internally uses the
get-query-args
I'm about to fix here, but to fix the issue related to this pr, we need to stop usingqs
and start using our function as stated above.I proposed to add that inside the calypso
README
file for other developers to be aware.We can create a ticket to remove qs library of course, but this is a huge take and I think it's better if we do it incrementally.
Maybe we should communicate that also to the calypso channel as well?
Any thoughts?
Thank you!
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.
@kozer I'm not sure
README
is quite the right approach. Can you create a new issue in https://github.com/Automattic/wp-calypso and we can discuss with the Calypso team?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.
I kind of agree with this. Is there is a reason not to return the value? You could just replace
decodeURIComponent
withsafeDecodeURIComponent
then.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.
Raising another hand of agreement. I think using
safeDecodeURIComponent
was the intention here since it does exactly what we're aiming for.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.
@ntsekouras , @tyxla I did the changes you proposed. Thanks so much!
I already have created an issue here. Do you think it make sense to open a new one?
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.
@kozer No, that's sufficient.
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.
Thanks for taking care of that, @kozer, looks great 🙌