From a951e4f4701dcc1b2f9aa85e739aefa1875f9834 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 01:57:52 +0200 Subject: [PATCH] Fix query detector to support Q and all future query types --- src/rss_thread_watch/feed_generator.clj | 2 +- src/rss_thread_watch/filters.clj | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index c5528c3..2094262 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -165,7 +165,7 @@ (response/redirect (get @conf/GLOBAL-CONFIG :homepage))))) ;; No querry specified - don't know what to search for - (when-not (prms "q") + (when-not (some f/known-filter-set (keys prms)) (throw (ex-info "400" {:status 400 :header {"Content-Type" "text/plain"} :body (str "400 You MUST specify query with one OR more'q=searchTerm' (or 'Q=SeARChteRm' for case sensitive) url parameter(s)\n\n\n" diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index 1573583..071da96 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -34,3 +34,5 @@ {"Q" case-sensitive-filter "q" case-insensitive-filter}) +(def known-filter-set (set (keys known-filters))) +