components/search: encode all searches

This commit is contained in:
Matilde Park 2022-10-18 21:55:36 -07:00
parent 33f570de0c
commit ffc7b41f9e

View File

@ -58,7 +58,7 @@ class Search extends Component {
onInputValueChange = debounce(async (query) => {
if (query.length) {
const search = fetch(this.searchEndpoint(query))
const search = fetch(this.searchEndpoint(encodeURIComponent(query)))
.then((res) => res.json())
.then(async (res) => {
// Wrap results in an object which will tell React what component to use to render results.
@ -90,7 +90,7 @@ class Search extends Component {
]
: [];
const urbitOrgSearch = fetch(this.urbitOrgSearch(query))
const urbitOrgSearch = fetch(this.urbitOrgSearch(encodeURIComponent(query)))
.then((res) => res.json())
.then((res) => {
return res.results.map((item) => ({
@ -99,7 +99,7 @@ class Search extends Component {
}));
});
const opsSearch = fetch(this.opsSearch(query))
const opsSearch = fetch(this.opsSearch(encodeURIComponent(query)))
.then((res) => res.json())
.then((res) => {
return [...res.glossary.map((item) => ({