0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-19 11:11:21 -05:00

🐛 Fix thumbnail saved in wrong bucket

This commit is contained in:
Andrey Antukh 2023-11-22 16:26:07 +01:00
parent 1adad4dbbc
commit 852e7472b7

View file

@ -838,7 +838,8 @@
(defmethod read-section :v1/sobjects
[{:keys [::sto/storage ::db/conn ::input ::overwrite?]}]
(let [storage (media/configure-assets-storage storage)
ids (read-obj! input)]
ids (read-obj! input)
thumb? (into #{} (map :media-id) (:thumbnails @*state*))]
(doseq [expected-storage-id ids]
(let [id (read-uuid! input)
@ -855,11 +856,17 @@
hash (sto/calculate-hash resource)
content (-> (sto/content resource size)
(sto/wrap-with-hash hash))
params (-> mdata
params (assoc mdata ::sto/content content)
params (if (thumb? id)
(-> params
(assoc ::sto/deduplicate? true)
(assoc ::sto/content content)
(assoc ::sto/touched-at (dt/now))
(assoc :bucket "file-media-object"))
(-> params
(assoc ::sto/deduplicate? false)
(assoc :bucket "file-object-thumbnail")))
sobject (sto/put-object! storage params)]