api icon indicating copy to clipboard operation
api copied to clipboard

Text input with leading slash can cause unexpected 400 errors

Open orangejulius opened this issue 4 years ago • 0 comments

An interesting report came in today, some short autocomplete queries return an unexpected 400 error with a leading slash (/).

Some examples that are broken:

/v1/autocomplete?text=/cali /v1/autocomplete?text=/colo /v1/autocomplete?text=/brook

Some examples that work:

/v1/autocomplete?text=/broo /v1/autocomplete?text=/asdf

In all broken cases, the parsed_text.subject property is just the slash:

"query": {
      "text": "/brook",
      "parser": "pelias",
      "parsed_text": {
        "subject": "/",
        "locality": "brook",
        "admin": "brook"
      },

It looks like whether or not the input was parsed as a subject will determine if this bug manifests or not, but maybe we want to fix it elsewhere, like by removing leading slashes?

orangejulius avatar Nov 19 '21 20:11 orangejulius