mirror of
https://github.com/penpot/penpot.git
synced 2026-05-01 14:18:07 +00:00
:spakles: Minor improvements on svg uploading on libraries.
Mainly reject svgs that have doctype declaration for security reasons.
This commit is contained in:
parent
4d19b87fff
commit
69ea8229ca
@ -183,7 +183,7 @@
|
||||
(us/assert ::input input)
|
||||
(let [{:keys [path mtype]} input]
|
||||
(if (= mtype "image/svg+xml")
|
||||
(let [info (some-> path slurp svg/pre-process svg/parse get-basic-info-from-svg)]
|
||||
(let [info (some-> path slurp svg/parse get-basic-info-from-svg)]
|
||||
(when-not info
|
||||
(ex/raise :type :validation
|
||||
:code :invalid-svg-file
|
||||
|
||||
@ -54,6 +54,6 @@
|
||||
[data]
|
||||
(cond-> data
|
||||
(str/includes? data "<!DOCTYPE")
|
||||
(str/replace #"<\!DOCTYPE[^>]+>" "")))
|
||||
(str/replace #"<\!DOCTYPE[^>]*>" "")))
|
||||
|
||||
(def pre-process strip-doctype)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user