We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28c94f0 commit 654edf2Copy full SHA for 654edf2
lib/url_utils.js
@@ -124,13 +124,11 @@ const UrlUtils = {
124
searchUrl += "%s";
125
}
126
searchUrl = searchUrl.replace(/%S/g, query);
127
- return searchUrl.replace(/%s/g, this.createSearchQuery(query));
128
- },
129
130
- // Map a search query to its URL encoded form. E.g. "BBC Sport" -> "BBC%20Sport".
131
- createSearchQuery(query) {
+ // Map a search query to its URL encoded form. E.g. "BBC Sport" -> "BBC%20Sport".
132
const parts = query.split(/\s+/);
133
- return parts.map(encodeURIComponent).join("%20");
+ const encodedQuery = parts.map(encodeURIComponent).join("%20");
+ return searchUrl.replace(/%s/g, encodedQuery);
134
},
135
};
136
0 commit comments