diff --git a/backend/src/gpml/domain/file.clj b/backend/src/gpml/domain/file.clj index 58aa02450..0dbc02322 100644 --- a/backend/src/gpml/domain/file.clj +++ b/backend/src/gpml/domain/file.clj @@ -3,7 +3,8 @@ [gpml.domain.miscellaneous :as dom.misc] [gpml.domain.types :as dom.types] [gpml.util :as util] - [malli.core :as m]) + [malli.core :as m] + [malli.transform :as mt]) (:import [java.io File])) (def ^:const object-key-pattern @@ -55,6 +56,10 @@ (str/replace #"FILE-KEY" (name file-key)) (str/replace #"FILE-ID" (str file-id)))) +(defn decode-file + [file] + (m/decode file-schema file mt/string-transformer)) + (defn base64->file [payload entity-key file-key visibility] (let [[_ ^String content-type ^String content] (re-find #"^data:(\S+);base64,(.*)$" payload)