Use encodeURIComponent for search queries

Should fix issue #244.
This commit is contained in:
Olle Fredriksson 2017-11-26 12:02:08 +01:00 committed by GitHub
parent 0b37c2250e
commit 86421b7586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ const normalizeUrl = (args, searchConfig) => {
if (concat.includes('.') && !concat.includes(' ')) {
return 'http://' + concat;
}
let query = encodeURI(concat);
let query = concat;
let template = searchConfig.engines[
searchConfig.default
];
@ -19,7 +19,7 @@ const normalizeUrl = (args, searchConfig) => {
template = searchConfig.engines[key];
}
}
return template.replace('{}', query);
return template.replace('{}', encodeURIComponent(query));
}
};