From 37e9adc6b6c3e36cd3179174671b07fc03139de2 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Fri, 8 Jul 2022 06:37:13 +0200 Subject: [PATCH] :bug: Fix set project on binary file import --- backend/src/app/rpc/commands/binfile.clj | 14 ++++++-------- frontend/src/app/worker/import.cljs | 3 ++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/src/app/rpc/commands/binfile.clj b/backend/src/app/rpc/commands/binfile.clj index 40d080d62..8e12e4a97 100644 --- a/backend/src/app/rpc/commands/binfile.clj +++ b/backend/src/app/rpc/commands/binfile.clj @@ -17,7 +17,6 @@ [app.db :as db] [app.media :as media] [app.rpc.queries.files :as files] - [app.rpc.queries.profile :as profile] [app.storage :as sto] [app.storage.tmp :as tmp] [app.tasks.file-gc] @@ -823,14 +822,13 @@ (s/def ::file ::media/upload) (s/def ::import-binfile - (s/keys :req-un [::profile-id ::file])) + (s/keys :req-un [::project-id ::file])) (sv/defmethod ::import-binfile "Import a penpot file in a binary format." - [{:keys [pool] :as cfg} {:keys [profile-id file] :as params}] - (let [project-id (-> (profile/retrieve-additional-data pool profile-id) :default-project-id)] - (import! (assoc cfg - ::input (:path file) - ::project-id project-id - ::ignore-index-errors? true)))) + [cfg {:keys [project-id file] :as params}] + (import! (assoc cfg + ::input (:path file) + ::project-id project-id + ::ignore-index-errors? true))) diff --git a/frontend/src/app/worker/import.cljs b/frontend/src/app/worker/import.cljs index 9c890a274..aff53ab5b 100644 --- a/frontend/src/app/worker/import.cljs +++ b/frontend/src/app/worker/import.cljs @@ -604,7 +604,8 @@ :response-type :blob :method :get}) (rx/map :body) - (rx/mapcat #(rp/command! :import-binfile {:file %})) + (rx/mapcat #(rp/command! :import-binfile {:file % + :project-id project-id})) (rx/map (fn [_] {:status :import-finish