fix: decode special characters in the search bar on 404 pages (#1098)

An extremely simple fix to decode special characters
This commit is contained in:
Celeste
2025-11-01 22:01:24 +01:00
committed by GitHub
parent 145cda7d45
commit e8fc315ead
+2 -2
View File
@@ -36,10 +36,10 @@
const wrongUrl = new URL(window.location.href); const wrongUrl = new URL(window.location.href);
/// Get the search keyword from the wrong URL by removing all slashes and dashes /// Get the search keyword from the wrong URL by removing all slashes and dashes
const searchKeyword = wrongUrl.pathname.split(/[/|-]/).join(' ').trim(); const searchKeyword = decodeURIComponent(wrongUrl.pathname).split(/[/|-]/).join(' ').trim();
document.getElementById('searchInput').setAttribute('value', searchKeyword); document.getElementById('searchInput').setAttribute('value', searchKeyword);
</script> </script>
{{- end -}} {{- end -}}
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{ end }} {{ end }}