mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 02:01:38 +02:00
🐛 Remove paths that can't be repaired on comp-v2 migration
This commit is contained in:
parent
0ea623487c
commit
3ea737deb1
1 changed files with 19 additions and 7 deletions
|
@ -127,6 +127,9 @@
|
||||||
(def valid-rgb-color-string?
|
(def valid-rgb-color-string?
|
||||||
(sm/lazy-validator ::ctc/rgb-color))
|
(sm/lazy-validator ::ctc/rgb-color))
|
||||||
|
|
||||||
|
(def valid-shape-points?
|
||||||
|
(sm/lazy-validator ::cts/points))
|
||||||
|
|
||||||
(defn- prepare-file-data
|
(defn- prepare-file-data
|
||||||
"Apply some specific migrations or fixes to things that are allowed in v1 but not in v2,
|
"Apply some specific migrations or fixes to things that are allowed in v1 but not in v2,
|
||||||
or that are the result of old bugs."
|
or that are the result of old bugs."
|
||||||
|
@ -287,6 +290,13 @@
|
||||||
(not (valid-text-content? (:content shape))))
|
(not (valid-text-content? (:content shape))))
|
||||||
(dissoc objects id)
|
(dissoc objects id)
|
||||||
|
|
||||||
|
(and (cfh/path-shape? shape)
|
||||||
|
(not (valid-path-content? (:content shape))))
|
||||||
|
(-> objects
|
||||||
|
(dissoc id)
|
||||||
|
(d/update-in-when [(:parent-id shape) :shapes]
|
||||||
|
(fn [shapes] (filterv #(not= id %) shapes))))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
objects))
|
objects))
|
||||||
|
|
||||||
|
@ -379,13 +389,15 @@
|
||||||
(and (cfh/path-shape? shape)
|
(and (cfh/path-shape? shape)
|
||||||
(seq (:content shape))
|
(seq (:content shape))
|
||||||
(not (valid-path-content? (:content shape))))
|
(not (valid-path-content? (:content shape))))
|
||||||
(let [shape (update shape :content fix-path-content)
|
(let [shape (update shape :content fix-path-content)]
|
||||||
[points selrect] (gshp/content->points+selrect shape (:content shape))]
|
(if (not (valid-path-content? (:content shape)))
|
||||||
(-> shape
|
shape
|
||||||
(dissoc :bool-content)
|
(let [[points selrect] (gshp/content->points+selrect shape (:content shape))]
|
||||||
(dissoc :bool-type)
|
(-> shape
|
||||||
(assoc :points points)
|
(dissoc :bool-content)
|
||||||
(assoc :selrect selrect)))
|
(dissoc :bool-type)
|
||||||
|
(assoc :points points)
|
||||||
|
(assoc :selrect selrect)))))
|
||||||
|
|
||||||
;; When we fount a bool shape with no content,
|
;; When we fount a bool shape with no content,
|
||||||
;; we convert it to a simple rect
|
;; we convert it to a simple rect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue