Merge pull request #134 from The-Running-Dev/bug/Fix_For_Overseer_Query_Parameters_With_Special_Characters

Bug: Fix for Query with Special Characters Failing Against Overseer
This commit is contained in:
Kiran Shila
2024-02-08 09:21:47 -08:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -10,7 +10,7 @@
(utils/request-and-process-body
impl/GET
(partial impl/process-search-result type)
(str "/search?query=" term))))
(str "/search?query=" (utils/url-encode-illegal-characters term)))))
; In Overseerr, the only additional option we'll need is which season,
; if the request type is a series

View File

@@ -8,6 +8,7 @@
[doplarr.state :as state]
[fmnoise.flow :as flow :refer [else then]]
[hato.client :as hc]
[hato.middleware :as hm]
[taoensso.timbre :refer [fatal trace]]
[clojure.set :as set]))
@@ -84,6 +85,15 @@
(str/trim (subs % 0 (- (count %) 2)))
(str/trim %)))))
(defn url-encode-illegal-characters
"Takes a raw url path or query and url-encodes any illegal characters.
Minimizes ambiguity by encoding space to %20."
[path-or-query]
(when path-or-query
(-> path-or-query
(str/replace #"[^a-zA-Z0-9]" hm/url-encode)
(str/replace "+" "%20"))))
(defn media-fn
"Resolves a function `f` in the backend namespace matching the available backend for a given `media`"
[media f]