about summary refs log tree commit diff stats
path: root/frontend/static/search.js
diff options
context:
space:
mode:
authorAlan Pearce2024-05-17 17:37:35 +0200
committerAlan Pearce2024-05-17 17:37:35 +0200
commit2edf3f098dd1bb79fd97a8f30fe28938cbde9f3c (patch)
tree52af1e04822033f259578c12266f3ff1fbde525d /frontend/static/search.js
parentf9b034027565bbc59b36d1a318716088c3a77977 (diff)
downloadsearchix-2edf3f098dd1bb79fd97a8f30fe28938cbde9f3c.tar.lz
searchix-2edf3f098dd1bb79fd97a8f30fe28938cbde9f3c.tar.zst
searchix-2edf3f098dd1bb79fd97a8f30fe28938cbde9f3c.zip
fix: render errors as HTML given correct content-type
Diffstat (limited to 'frontend/static/search.js')
-rw-r--r--frontend/static/search.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/frontend/static/search.js b/frontend/static/search.js
index 030a318..d9993e4 100644
--- a/frontend/static/search.js
+++ b/frontend/static/search.js
@@ -80,7 +80,8 @@ async function getResults(url) {
       },
     });
 
-    if (res.ok) {
+    // render errors sent as HTML as well as OK responses
+    if (res.headers.get("content-type").startsWith("text/html")) {
       state.fragment = await res.text();
       state.opened = [];
       history.replaceState(state, null, url);