mirror of
https://github.com/penpot/penpot.git
synced 2025-03-16 17:51:18 -05:00
🐛 Fix unexpected exception on upload invalid image.
This commit is contained in:
parent
76e43f339a
commit
9b875aba21
2 changed files with 11 additions and 3 deletions
|
@ -175,7 +175,12 @@
|
||||||
(ex/raise :type :internal
|
(ex/raise :type :internal
|
||||||
:code :rlimit-not-configured
|
:code :rlimit-not-configured
|
||||||
:hint ":image rlimit not configured"))
|
:hint ":image rlimit not configured"))
|
||||||
(rlm/execute rlimit (process params))))
|
(try
|
||||||
|
(rlm/execute rlimit (process params))
|
||||||
|
(catch org.im4java.core.InfoException e
|
||||||
|
(ex/raise :type :validation
|
||||||
|
:code :invalid-image
|
||||||
|
:cause e)))))
|
||||||
|
|
||||||
;; --- Utility functions
|
;; --- Utility functions
|
||||||
|
|
||||||
|
|
|
@ -417,13 +417,16 @@
|
||||||
(defn- handle-upload-error [on-error stream]
|
(defn- handle-upload-error [on-error stream]
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/catch
|
(rx/catch
|
||||||
(fn on-error [error]
|
(fn on-error* [error]
|
||||||
(if (ex/ex-info? error)
|
(if (ex/ex-info? error)
|
||||||
(on-error (ex-data error))
|
(on-error* (ex-data error))
|
||||||
(cond
|
(cond
|
||||||
(= (:code error) :media-type-not-allowed)
|
(= (:code error) :media-type-not-allowed)
|
||||||
(rx/of (dm/error (tr "errors.media-type-not-allowed")))
|
(rx/of (dm/error (tr "errors.media-type-not-allowed")))
|
||||||
|
|
||||||
|
(= (:code error) :invalid-image)
|
||||||
|
(rx/of (dm/error (tr "errors.media-type-not-allowed")))
|
||||||
|
|
||||||
(= (:code error) :media-too-large)
|
(= (:code error) :media-too-large)
|
||||||
(rx/of (dm/error (tr "errors.media-too-large")))
|
(rx/of (dm/error (tr "errors.media-too-large")))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue