summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'server.js')
-rw-r--r--server.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/server.js b/server.js
index 3ec7454..82adb93 100644
--- a/server.js
+++ b/server.js
@@ -1104,8 +1104,13 @@ app.post("/forum/reply/:thread_id", must_be_logged_in, function (req, res) {
app.get("/forum/search", must_be_logged_in, function (req, res) {
let search = req.query.q
let results = []
- if (search)
- results = FORUM_SEARCH.all(search)
+ if (search) {
+ try {
+ results = FORUM_SEARCH.all(search)
+ } catch (err) {
+ results = FORUM_SEARCH.all('"' + search.replaceAll('"', '""') + '"')
+ }
+ }
res.render("forum_search.pug", { user: req.user, search, results })
})