manulera / ShareYourCloning_backend

The backend application for ShareYourCloning
MIT License
2 stars 6 forks source link

`SyntaxError: Invalid regular expression` in the autocomplete species form "Locus from reference genome" #177

Closed dgruano closed 3 months ago

dgruano commented 3 months ago

This is a funky one, don't ask.

While trying to type pombe, I mistyped /[po in the species search form in the "Locus from reference genome" search. The app crashed and I got the following console errors:

SyntaxError: Invalid regular expression: //[po/: Unterminated character class (at index-d4b73013.js:1329:2134)

Error: Minified React error #300; visit https://reactjs.org/docs/error-decoder.html?invariant=300 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

I have not looked deeper into this, but I can tell you it does not show the same behavior in the "Gene selection" form.

We should try to catch these regex errors.

manulera commented 3 months ago

Thanks, this was happening in the frontend, when I use regex to match with E. coli, which is not returned by the datasets API. I have to look into that at some point, which also causes https://github.com/manulera/ShareYourCloning_frontend/issues/218 and others.

You can see the commit for the fix (basically escaping the regex string)