unescaped user input
kylegrover opened this issue Ā· comments
Kyle Grover commented
typing ie /
or +
into the 'Search country' field crashes the app
problem occurs @ index.js:372 new RegExp(countrySearchQuery.trim(), 'i')
Kyle Grover commented
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
suggests this code
function escapeRegExp(string){
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
Oleksii Trekhleb commented
Very good point! Thanks @kylegrover. It should be fixed now.