diff --git a/CHANGES.md b/CHANGES.md index affe7d1318..6ec6040693 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/backend/src/app/binfile/v3.clj b/backend/src/app/binfile/v3.clj index c2b46b4159..f4684072fa 100644 --- a/backend/src/app/binfile/v3.clj +++ b/backend/src/app/binfile/v3.clj @@ -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)) - (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))) + (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)))) (let [params (-> object (dissoc :id :size)