Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Handle query values as objects for cached parsed urls
Browse files Browse the repository at this point in the history
Fix #8938

Auditors: @bsclifton

This shouldn't be happening but Sriram got a crash with it, so handling query as an object
  • Loading branch information
bbondy committed May 18, 2017
1 parent 2684d06 commit 065b51a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/common/lib/siteSuggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ const tokenizeInput = (data) => {
parts = parts.concat(parsedUrl.pathname.split(/[.\s\\/]/))
}
if (parsedUrl.query) {
// I think fast-url-parser has a bug in it where it returns an object for query
// instead of a string. Object is supported but only when you pass in true
// for the second value of parse which we don't do.
// We can remove this when we change away from using fast-url-parser in favour of the
// Chrome URL parser.
if (parsedUrl.query.constructor !== String) {
parsedUrl.query = Object.entries(parsedUrl.query).map((x) => x.join('=')).join('&')
}
parts = parts.concat(parsedUrl.query.split(/[&=]/))
}
if (parsedUrl.protocol) {
Expand Down

1 comment on commit 065b51a

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

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

++

Please sign in to comment.