Skip to content

Commit

Permalink
fix(query): ignore empty tokens
Browse files Browse the repository at this point in the history
Empty tokens should not make it this far into the query code, but it can
happen.

In that case, we should ignore empty tokens and avoid aggrivating the
`VariableStore` checks by attempting to store empty strings.

This fixes the 500 erro described in
#1535, but doesn't really fix the
underlying problem.

From my investigation it looks like Emoji that include tokens like a
[variation selector](https://emojipedia.org/variation-selector-16/) will
not be completely removed by the Pelias Parser (the emoji codepoint will
be removed, but not the variation selector).
  • Loading branch information
orangejulius committed Jun 19, 2021
1 parent 33ab9d0 commit 210b00c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion query/view/admin_multi_match_first.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function (adminFields) {
// the actual query text is simply taken from the first valid admin field
// this assumes all the values would be the same, which is probably not true
// TODO: handle the case where not all admin area input values are the same
var tokens = vs.var('input:' + valid_admin_properties[0]).get().split(/\s+/g);
var tokens = vs.var('input:' + valid_admin_properties[0]).get().split(/\s+/g).filter(t => t.length > 0);

// no valid tokens to use, fail now, don't render this view.
if (!tokens || tokens.length < 2) { return null; }
Expand Down

0 comments on commit 210b00c

Please sign in to comment.