Skip to content

Adding commas to the first 10 words of a class name can cause HTTP 400 errors

Sentry Issue: ARKINDEX-FRONTEND-C6X

AxiosError: Request failed with status code 400
  at settle (../../node_modules/axios/lib/core/settle.js:19:12)
  at onloadend (../../node_modules/axios/lib/adapters/xhr.js:59:7)
  1. Browse a corpus with at least one ML class.
  2. View any element.
  3. In the input to add a new classification on the details panel, type 1,2,3,4,5,6,7,8,9,10,11
  4. Get error notifications with Request failed with status code 400.
  5. Cry.

DRF's search fields feature treats a,b c as a search for either a or b or c, but it also limits this to 10 search terms. We already restrict to 10 terms separated by whitespace, but we do not account for commas.

https://github.com/encode/django-rest-framework/blob/c0202a0aa5cbaf8573458b932878dfd5044c93ab/rest_framework/filters.py#L33