Commit 24d07f61 authored by Robert Chen's avatar Robert Chen Committed by Benjamin Wheeler

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

* Fixed turning '+' into ' '

* Fixed issue 2160

* Added space before '{'
parent 1ae8180a
...@@ -78,7 +78,12 @@ class Search extends React.Component { ...@@ -78,7 +78,12 @@ class Search extends React.Component {
while (term.indexOf('&') > -1) { while (term.indexOf('&') > -1) {
term = term.substring(0, term.indexOf('&')); 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)); this.props.dispatch(navigationActions.setSearchTerm(term));
} }
componentDidUpdate (prevProps) { componentDidUpdate (prevProps) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment