🐛 Sanitize wrong ids in token themes (#6843)

This commit is contained in:
Andrés Moya
2025-07-03 15:31:45 +02:00
committed by GitHub
parent 7dd61968b5
commit c09f72c3d5

View File

@@ -610,13 +610,17 @@
(defn make-token-theme (defn make-token-theme
[& {:as attrs}] [& {:as attrs}]
(let [id (uuid/next)] (let [new-id (uuid/next)]
(-> attrs (-> attrs
(update :id d/nilv id) (update :id (fn [id]
(-> (if (string? id) ;; TODO: probably this may be deleted in some time, when we may be sure
(uuid/parse* id) ;; that no file exists that has not been correctly migrated to
id) ;; convert :id into :external-id
(d/nilv new-id))))
(update :group d/nilv top-level-theme-group-name) (update :group d/nilv top-level-theme-group-name)
(update :description d/nilv "") (update :description d/nilv "")
(update :is-source d/nilv false) (update :is-source d/nilv false)
(update :external-id #(or % (str id))) (update :external-id #(or % (str new-id)))
(update :modified-at #(or % (dt/now))) (update :modified-at #(or % (dt/now)))
(update :sets set) (update :sets set)
(check-token-theme-attrs) (check-token-theme-attrs)