0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

🐛 Properly handle path with fill-image on file media gc task.

This commit is contained in:
Andrey Antukh 2021-07-15 11:57:15 +02:00
parent a6d156438f
commit 5126c85623

View file

@ -64,16 +64,21 @@
(comp
(map :objects)
(mapcat vals)
(filter #(= :image (:type %)))
(map :metadata)
(map :id)))
(map (fn [{:keys [type] :as obj}]
(case type
:path (get-in obj [:fill-image :id])
:image (get-in obj [:metadata :id])
nil)))
(filter uuid?)))
(defn- collect-used-media
[data]
(let [pages (concat
(vals (:pages-index data))
(vals (:components data)))]
(-> #{}
(into collect-media-xf (vals (:pages-index data)))
(into collect-media-xf (vals (:components data)))
(into (keys (:media data)))))
(into collect-media-xf pages)
(into (keys (:media data))))))
(defn- process-file
[{:keys [conn] :as cfg} {:keys [id data age] :as file}]