diff --git a/backend/src/app/srepl/fixes.clj b/backend/src/app/srepl/fixes.clj index 955b87f81..5e450e0d9 100644 --- a/backend/src/app/srepl/fixes.clj +++ b/backend/src/app/srepl/fixes.clj @@ -16,8 +16,26 @@ [app.common.logging :as l] [app.common.uuid :as uuid] [app.db :as db] + [app.features.fdata :as feat.fdata] [app.srepl.helpers :as h])) +(defn disable-fdata-features + [{:keys [id features] :as file} _] + (when (or (contains? features "fdata/pointer-map") + (contains? features "fdata/objects-map")) + (l/warn :hint "disable fdata features" :file-id (str id)) + (-> file + (update :data feat.fdata/process-pointers deref) + (update :data feat.fdata/process-objects (partial into {})) + (update :features disj "fdata/pointer-map" "fdata/objects-map")))) + +(defn find-fdata-pointers + [{:keys [id features data] :as file} _] + (when (contains? features "fdata/pointer-map") + (let [pointers (feat.fdata/get-used-pointer-ids data)] + (l/warn :hint "found pointers" :file-id (str id) :pointers pointers) + nil))) + (defn repair-file-media "A helper intended to be used with `srepl.main/process-files!` that fixes all not propertly referenced file-media-object for a file"