mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge pull request #4913 from penpot/superalex-fix-files-with-invalid-library-colors
🐛 Fix file with invalid library colors
This commit is contained in:
@@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
(ns app.common.files.defaults)
|
(ns app.common.files.defaults)
|
||||||
|
|
||||||
(def version 50)
|
(def version 51)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.svg :as csvg]
|
[app.common.svg :as csvg]
|
||||||
[app.common.text :as txt]
|
[app.common.text :as txt]
|
||||||
|
[app.common.types.color :as ctc]
|
||||||
[app.common.types.component :as ctk]
|
[app.common.types.component :as ctk]
|
||||||
[app.common.types.file :as ctf]
|
[app.common.types.file :as ctf]
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
@@ -1004,6 +1005,17 @@
|
|||||||
(update :pages-index update-vals update-container)
|
(update :pages-index update-vals update-container)
|
||||||
(update :components update-vals update-container))))
|
(update :components update-vals update-container))))
|
||||||
|
|
||||||
|
(def ^:private valid-color?
|
||||||
|
(sm/lazy-validator ::ctc/color))
|
||||||
|
|
||||||
|
(defn migrate-up-51
|
||||||
|
"This migration fixes library invalid colors"
|
||||||
|
|
||||||
|
[data]
|
||||||
|
(let [update-colors
|
||||||
|
(fn [colors]
|
||||||
|
(into {} (filter #(-> % val valid-color?) colors)))]
|
||||||
|
(update data :colors update-colors)))
|
||||||
|
|
||||||
(def migrations
|
(def migrations
|
||||||
"A vector of all applicable migrations"
|
"A vector of all applicable migrations"
|
||||||
@@ -1046,4 +1058,5 @@
|
|||||||
{:id 47 :migrate-up migrate-up-47}
|
{:id 47 :migrate-up migrate-up-47}
|
||||||
{:id 48 :migrate-up migrate-up-48}
|
{:id 48 :migrate-up migrate-up-48}
|
||||||
{:id 49 :migrate-up migrate-up-49}
|
{:id 49 :migrate-up migrate-up-49}
|
||||||
{:id 50 :migrate-up migrate-up-50}])
|
{:id 50 :migrate-up migrate-up-50}
|
||||||
|
{:id 51 :migrate-up migrate-up-51}])
|
||||||
|
|||||||
Reference in New Issue
Block a user