if (searchParam === '') {
this.context.router.history.push(`/search/`);
} else {
+ const searchParamEncoded = encodeURIComponent(searchParam);
this.context.router.history.push(
- `/search/q/${searchParam}/type/All/sort/TopAll/page/1`
+ `/search/q/${searchParamEncoded}/type/All/sort/TopAll/page/1`
);
}
}
};
static getSearchQueryFromProps(q: string): string {
- return q || '';
+ return decodeURIComponent(q) || '';
}
static getSearchTypeFromProps(type_: string): SearchType {
updateUrl(paramUpdates: UrlParams) {
const qStr = paramUpdates.q || this.state.q;
+ const qStrEncoded = encodeURIComponent(qStr);
const typeStr = paramUpdates.type_ || this.state.type_;
const sortStr = paramUpdates.sort || this.state.sort;
const page = paramUpdates.page || this.state.page;
this.props.history.push(
- `/search/q/${qStr}/type/${typeStr}/sort/${sortStr}/page/${page}`
+ `/search/q/${qStrEncoded}/type/${typeStr}/sort/${sortStr}/page/${page}`
);
}