-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Enterprise Search] Prevent double encoding in enterprise_search_request_handler #79747
Conversation
enterprise_search_request_handler was double encoding urls. This is because `querystring.stringify` was already encoding, and we were subsequentally calling `encodeURI` on the same url. This resulted in something like "page[current]=2" to be converted to "page%255Bcurrent%255D=2", rather than "page%5Bcurrent%5D=2"; it was double encoded. References: https://nodejs.org/api/querystring.html See the `encodeURIComponent` option for the `stringify` method, which defaults to `escape`.
x-pack/plugins/enterprise_search/server/lib/enterprise_search_request_handler.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/enterprise_search/server/lib/enterprise_search_request_handler.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/enterprise_search/server/lib/enterprise_search_request_handler.test.ts
Show resolved
Hide resolved
Co-authored-by: Constance <[email protected]>
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.
Woo, thanks for catching this Jason! 🎉
💚 Build SucceededMetrics [docs]
To update your PR or re-run it, just comment with: |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
1 similar comment
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Backporting on behalf of Jason since he's out most of this week |
…est_handler (#79747) (#80172) Co-authored-by: Jason Stoltzfus <[email protected]>
Thank you @constancecchen |
enterprise_search_request_handler was double encoding urls.
This is because
querystring.stringify
was already encoding, andwe were subsequentally calling
encodeURI
on the same url.This resulted in something like "page[current]=2" to be converted
to "page%255Bcurrent%255D=2", rather than
"page%5Bcurrent%5D=2"; it was double encoded.
References: https://nodejs.org/api/querystring.html
See the
encodeURIComponent
option for thestringify
method, whichdefaults to
escape
.Summary
Summarize your PR. If it involves visual changes include a screenshot or gif.
Checklist
Delete any items that are not applicable to this PR.
For maintainers