Skip to content

Commit c747a3b

Browse files
authored
fix: Escape language queries correctly (#1003)
`escape` escapes certain characters, but those don't include `+`, so clicking a `C++` language link will result in the `+`s not being escaped in the URL. This causes the search to search for `"C "` which finds no results. `encodeURIComponent` is what should be used.
1 parent 886b229 commit c747a3b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

web/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ document.onkeydown=function(e){
213213
<title>Results for {{.QueryStr}}</title>
214214
<script>
215215
function zoektAddQ(atom) {
216-
window.location.href = "/search?q=" + escape("{{.QueryStr}}" + " " + atom) +
216+
window.location.href = "/search?q=" + encodeURIComponent("{{.QueryStr}}" + " " + atom) +
217217
"&" + "num=" + {{.Last.Num}};
218218
}
219219
</script>

0 commit comments

Comments
 (0)