Fix gh-2160: Search with % (#2161)

* Fixed turning '+' into ' '

* Fixed issue 2160

* Added space before '{'
This commit is contained in:
Robert Chen 2018-10-15 06:36:05 -07:00 committed by Benjamin Wheeler
parent 1ae8180aa4
commit 24d07f6139

View file

@ -78,7 +78,12 @@ class Search extends React.Component {
while (term.indexOf('&') > -1) {
term = term.substring(0, term.indexOf('&'));
}
term = decodeURIComponent(term.split('+').join(' '));
try {
term = decodeURIComponent(term);
} catch (e) {
// Error means that term was not URI encoded and decoding failed.
// We can silence this error because not all query strings are intended to be decoded.
}
this.props.dispatch(navigationActions.setSearchTerm(term));
}
componentDidUpdate (prevProps) {