diff --git a/backend/src/app/rpc/commands/binfile.clj b/backend/src/app/rpc/commands/binfile.clj index 7e7327b32..e3015c023 100644 --- a/backend/src/app/rpc/commands/binfile.clj +++ b/backend/src/app/rpc/commands/binfile.clj @@ -593,6 +593,7 @@ (declare lookup-index) (declare update-index) (declare relink-media) +(declare relink-colors) (declare relink-shapes) (defmulti read-import ::version) @@ -723,6 +724,7 @@ (update :pages-index relink-shapes) (update :components relink-shapes) (update :media relink-media) + (update :colors relink-colors) (d/without-nils)))))) @@ -997,6 +999,17 @@ media media)) +(defn- relink-colors + "A function responsible of process the :colors attr of file data and + remap the old ids with the new ones." + [colors] + (reduce-kv (fn [res k v] + (if (:image v) + (update-in res [k :image :id] lookup-index) + res)) + colors + colors)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; HIGH LEVEL API ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;