mirror of
https://github.com/penpot/penpot.git
synced 2025-03-10 06:41:40 -05:00
🐛 Fix minor issue on internal srepl helpers
This commit is contained in:
parent
7e803eeca8
commit
a6c9ced5b3
2 changed files with 14 additions and 9 deletions
|
@ -35,15 +35,18 @@
|
|||
|
||||
(defn get-file
|
||||
"Get the migrated data of one file."
|
||||
([id] (get-file (or *system* main/system) id))
|
||||
([system id]
|
||||
([id] (get-file (or *system* main/system) id nil))
|
||||
([system id & {:keys [raw?] :as opts}]
|
||||
(db/run! system
|
||||
(fn [system]
|
||||
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer system id)]
|
||||
(-> (files/get-file system id :migrate? false)
|
||||
(update :data feat.fdata/process-pointers deref)
|
||||
(update :data feat.fdata/process-objects (partial into {}))
|
||||
(fmg/migrate-file)))))))
|
||||
(let [file (files/get-file system id :migrate? false)]
|
||||
(if raw?
|
||||
file
|
||||
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer system id)]
|
||||
(-> file
|
||||
(update :data feat.fdata/process-pointers deref)
|
||||
(update :data feat.fdata/process-objects (partial into {}))
|
||||
(fmg/migrate-file)))))))))
|
||||
|
||||
(defn update-file!
|
||||
[system {:keys [id] :as file}]
|
||||
|
@ -166,7 +169,7 @@
|
|||
(fsnap/take-file-snapshot! system {:file-id file-id :label label}))
|
||||
|
||||
(let [conn (db/get-connection system)
|
||||
file (get-file system file-id)
|
||||
file (get-file system file-id opts)
|
||||
libs (when with-libraries?
|
||||
(->> (files/get-file-libraries conn file-id)
|
||||
(into [file] (map (fn [{:keys [id]}]
|
||||
|
|
|
@ -429,7 +429,9 @@
|
|||
(try
|
||||
(l/trc :hint "process:file:start" :file-id (str file-id) :index idx)
|
||||
(let [system (assoc main/system ::db/rollback rollback?)]
|
||||
(db/tx-run! system h/process-file! file-id update-fn opts))
|
||||
(db/tx-run! system (fn [system]
|
||||
(binding [h/*system* system]
|
||||
(h/process-file! system file-id update-fn opts)))))
|
||||
|
||||
(catch Throwable cause
|
||||
(l/wrn :hint "unexpected error on processing file (skiping)"
|
||||
|
|
Loading…
Add table
Reference in a new issue