mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 05:16:13 +02:00
🐛 Fix incorrect webhook url validation
This commit is contained in:
parent
f18d2ea629
commit
9143639357
1 changed files with 13 additions and 14 deletions
|
@ -48,25 +48,24 @@
|
||||||
(defn- validate-webhook!
|
(defn- validate-webhook!
|
||||||
[cfg whook params]
|
[cfg whook params]
|
||||||
(when (not= (:uri whook) (:uri params))
|
(when (not= (:uri whook) (:uri params))
|
||||||
(try
|
(let [response (ex/try!
|
||||||
(let [response (http/req! cfg
|
(http/req! cfg
|
||||||
{:method :head
|
{:method :head
|
||||||
:uri (str (:uri params))
|
:uri (str (:uri params))
|
||||||
:timeout (dt/duration "3s")}
|
:timeout (dt/duration "3s")}
|
||||||
{:sync? true})]
|
{:sync? true}))]
|
||||||
(when-let [hint (webhooks/interpret-response response)]
|
(if (ex/exception? response)
|
||||||
(ex/raise :type :validation
|
(if-let [hint (webhooks/interpret-exception response)]
|
||||||
:code :webhook-validation
|
|
||||||
:hint hint)))
|
|
||||||
|
|
||||||
(catch Throwable cause
|
|
||||||
(if-let [hint (webhooks/interpret-exception cause)]
|
|
||||||
(ex/raise :type :validation
|
(ex/raise :type :validation
|
||||||
:code :webhook-validation
|
:code :webhook-validation
|
||||||
:hint hint)
|
:hint hint)
|
||||||
(ex/raise :type :internal
|
(ex/raise :type :internal
|
||||||
:code :webhook-validation
|
:code :webhook-validation
|
||||||
:cause cause))))))
|
:cause response))
|
||||||
|
(when-let [hint (webhooks/interpret-response response)]
|
||||||
|
(ex/raise :type :validation
|
||||||
|
:code :webhook-validation
|
||||||
|
:hint hint))))))
|
||||||
|
|
||||||
(defn- validate-quotes!
|
(defn- validate-quotes!
|
||||||
[{:keys [::db/pool]} {:keys [team-id]}]
|
[{:keys [::db/pool]} {:keys [team-id]}]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue