Make the hash optional on binfile-v3

Backport the change from develop
This commit is contained in:
Andrey Antukh 2025-06-02 23:18:41 +02:00
parent 27ab910a64
commit 3131eec271
2 changed files with 11 additions and 8 deletions

View file

@ -6,6 +6,8 @@
### :bug: Bugs fixed
- Update plugins runtime [Github #6604](https://github.com/penpot/penpot/pull/6604)
- Backport from develop a minor fix that enables import of files
generated by penpot library [Github #6614](https://github.com/penpot/penpot/pull/6614)
## 2.7.1

View file

@ -73,7 +73,7 @@
[:size ::sm/int]
[:content-type :string]
[:bucket [::sm/one-of {:format :string} sto/valid-buckets]]
[:hash :string]])
[:hash {:optional true} :string]])
(def ^:private schema:file-thumbnail
[:map {:title "FileThumbnail"}
@ -821,13 +821,14 @@
:expected-size (:size object)
:found-size (sto/get-size content)))
(when (not= (:hash object) (sto/get-hash content))
(when-let [hash (get object :hash)]
(when (not= hash (sto/get-hash content))
(ex/raise :type :validation
:code :inconsistent-penpot-file
:hint "found corrupted storage object: hash does not match"
:path path
:expected-hash (:hash object)
:found-hash (sto/get-hash content)))
:found-hash (sto/get-hash content))))
(let [params (-> object
(dissoc :id :size)