mirror of
https://github.com/penpot/penpot.git
synced 2025-07-27 01:27:17 +02:00
✨ Improve decode empty string for path content
This commit is contained in:
parent
9ea3f81bc4
commit
f3616c68a0
2 changed files with 6 additions and 2 deletions
|
@ -117,6 +117,7 @@
|
||||||
[:ref-id {:optional true} ::sm/uuid]
|
[:ref-id {:optional true} ::sm/uuid]
|
||||||
[:ref-file {:optional true} ::sm/uuid]])
|
[:ref-file {:optional true} ::sm/uuid]])
|
||||||
|
|
||||||
|
;; This schema represent an "applied color"
|
||||||
(def schema:color
|
(def schema:color
|
||||||
[:and
|
[:and
|
||||||
[:merge {:title "Color"}
|
[:merge {:title "Color"}
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
[app.common.schema.generators :as sg]
|
[app.common.schema.generators :as sg]
|
||||||
[app.common.svg.path :as svg.path]
|
[app.common.svg.path :as svg.path]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.common.types.path :as-alias path])
|
[app.common.types.path :as-alias path]
|
||||||
|
[cuerdas.core :as str])
|
||||||
(:import
|
(:import
|
||||||
#?(:cljs [goog.string StringBuffer]
|
#?(:cljs [goog.string StringBuffer]
|
||||||
:clj [java.nio ByteBuffer ByteOrder])))
|
:clj [java.nio ByteBuffer ByteOrder])))
|
||||||
|
@ -530,7 +531,9 @@
|
||||||
:decode/json (fn [s]
|
:decode/json (fn [s]
|
||||||
(cond
|
(cond
|
||||||
(string? s)
|
(string? s)
|
||||||
(from-string s)
|
(if (str/empty? s)
|
||||||
|
(from-plain [])
|
||||||
|
(from-string s))
|
||||||
|
|
||||||
(vector? s)
|
(vector? s)
|
||||||
(let [decode-fn (deref decoder)]
|
(let [decode-fn (deref decoder)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue