mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 06:36:37 +02:00
🐛 Force file-id association with file-media-object on exportation
This is needed because we may have situation when a file is using a file-media-object reference from other file (probably a library that is not included in the exportation); in this case we need to forcely embed it.
This commit is contained in:
parent
183e0bf985
commit
c30d4d313c
1 changed files with 8 additions and 2 deletions
|
@ -301,11 +301,17 @@
|
||||||
"SELECT * FROM file_media_object WHERE id = ANY(?)")
|
"SELECT * FROM file_media_object WHERE id = ANY(?)")
|
||||||
|
|
||||||
(defn- retrieve-file-media
|
(defn- retrieve-file-media
|
||||||
[pool {:keys [data] :as file}]
|
[pool {:keys [data id] :as file}]
|
||||||
(with-open [^AutoCloseable conn (db/open pool)]
|
(with-open [^AutoCloseable conn (db/open pool)]
|
||||||
(let [ids (app.tasks.file-gc/collect-used-media data)
|
(let [ids (app.tasks.file-gc/collect-used-media data)
|
||||||
ids (db/create-array conn "uuid" ids)]
|
ids (db/create-array conn "uuid" ids)]
|
||||||
(db/exec! conn [sql:file-media-objects ids]))))
|
|
||||||
|
;; We assoc the file-id again to the file-media-object row
|
||||||
|
;; because there are cases that used objects refer to other
|
||||||
|
;; files and we need to ensure in the exportation process that
|
||||||
|
;; all ids matches
|
||||||
|
(->> (db/exec! conn [sql:file-media-objects ids])
|
||||||
|
(mapv #(assoc % :file-id id))))))
|
||||||
|
|
||||||
(def ^:private storage-object-id-xf
|
(def ^:private storage-object-id-xf
|
||||||
(comp
|
(comp
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue