mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix 0006 migration for strings that should be uuids
This commit is contained in:
@@ -1413,17 +1413,27 @@
|
|||||||
(defmethod migrate-data "0006-fix-old-texts-fills"
|
(defmethod migrate-data "0006-fix-old-texts-fills"
|
||||||
[data _]
|
[data _]
|
||||||
(letfn [(fix-fills [node]
|
(letfn [(fix-fills [node]
|
||||||
(let [fills (if (and (not (seq (:fills node)))
|
(let [;; In the old format refs were strings
|
||||||
(or (some? (:fill-color node))
|
sanitize-uuid
|
||||||
(some? (:fill-opacity node))
|
(fn [o]
|
||||||
(some? (:fill-color-gradient node))))
|
(if (uuid? o)
|
||||||
[(d/without-nils (select-keys node [:fill-color :fill-opacity :fill-color-gradient
|
o
|
||||||
:fill-color-ref-id :fill-color-ref-file]))]
|
(uuid/parse* o)))
|
||||||
(:fills node))]
|
|
||||||
(-> node
|
fills
|
||||||
(assoc :fills fills)
|
(if (and (not (seq (:fills node)))
|
||||||
(dissoc :fill-color :fill-opacity :fill-color-gradient
|
(or (some? (:fill-color node))
|
||||||
:fill-color-ref-id :fill-color-ref-file))))
|
(some? (:fill-opacity node))
|
||||||
|
(some? (:fill-color-gradient node))))
|
||||||
|
[(-> (select-keys node types.fills/fill-attrs)
|
||||||
|
(update :fill-color-ref-file sanitize-uuid)
|
||||||
|
(update :fill-color-ref-id sanitize-uuid)
|
||||||
|
(d/without-nils))]
|
||||||
|
(:fills node))]
|
||||||
|
|
||||||
|
(reduce dissoc
|
||||||
|
(assoc node :fills fills)
|
||||||
|
types.fills/fill-attrs)))
|
||||||
|
|
||||||
(update-object [object]
|
(update-object [object]
|
||||||
(if (cfh/text-shape? object)
|
(if (cfh/text-shape? object)
|
||||||
|
|||||||
Reference in New Issue
Block a user