Text input with leading slash can cause unexpected 400 errors
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 259
- Forks
- 168
- Avg merge
- 6h 15m
- Merged PRs (30d)
- 1
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the autocomplete API entry point and trace how a leading slash becomes parsed_text.subject and can produce a 400 response. Reproduce the linked /cali, /colo, and /brook examples alongside the working cases; done means leading-slash autocomplete queries no longer fail unexpectedly and parsing remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100