kiranshila / Doplarr

An *arr request bot for Discord
MIT License
407 stars 30 forks source link

Request titles containing slashes unsearchable #97

Open ivybennett-ford opened 1 year ago

ivybennett-ford commented 1 year ago

Bot tells me the search does not return a result when I query targets with slashes in the body. Have not started to fix this, logging it here so I don't forget.

I expect to be able to default to a slash-less prompt, but a successful search is apparently unsuccessful for the examples I've tried (Except for Face/Off lol)

Entering command again with previous result of same query displayed above slash-command-log

For some reason going slashless works for this title, bot not others (specifically V/H/S. but also titles in this very helpful thread) slash-command-log2

domainzero commented 1 year ago

This also happens with titles that contain an apostrophe, ' , so it probably happens with other escapable characters too.

The-Running-Dev commented 5 months ago

Yup, just encountered this with a colon. The issue is utils.clj

(defn http-request [method url key & [params]]
  (let [chan (a/promise-chan)
        put (fn [v]
              (trace "HTTP Response " v)
              (a/put! chan v))]
    (trace "Performing HTTP request" method url params)
    (hc/request
     (deep-merge
      {:method method
       :url url
       :as :json-string-keys
       :coerce :always
       :async? true
       :headers {"X-API-Key" key}}
      params)
     put
     put)
    chan))

Query:

"http://192.168.20.20:5055/api/v1/search?query=Freeway: Crack in the System",

Response:

"Parameter 'query' must be url encoded. Its value may not contain reserved characters."}]}