diff --git a/backend/src/app/storage/tmp.clj b/backend/src/app/storage/tmp.clj index 92cda29ebb..376c6ae8b0 100644 --- a/backend/src/app/storage/tmp.clj +++ b/backend/src/app/storage/tmp.clj @@ -11,13 +11,16 @@ permanently delete these files (look at systemd-tempfiles)." (:require [app.common.logging :as l] + [app.common.uuid :as uuid] [app.util.time :as dt] [app.worker :as wrk] [clojure.spec.alpha :as s] [datoteka.fs :as fs] [integrant.core :as ig] [promesa.exec :as px] - [promesa.exec.csp :as sp])) + [promesa.exec.csp :as sp]) + (:import + java.nio.file.Files)) (def default-tmp-dir "/tmp/penpot") @@ -76,11 +79,9 @@ [& {:keys [suffix prefix min-age] :or {prefix "penpot." suffix ".tmp"}}] - (let [path (fs/create-tempfile - :perms "rw-r--r--" - :dir default-tmp-dir - :suffix suffix - :prefix prefix)] + (let [attrs (fs/make-permissions "rw-r--r--") + path (fs/join default-tmp-dir (str prefix (uuid/next) suffix)) + path (Files/createFile path attrs)] (fs/delete-on-exit! path) (sp/offer! queue [path (some-> min-age dt/duration)]) path))