From e55d1a3b7f505db760c1f6d350d20d7edd3fb988 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 12 Feb 2024 14:53:56 +0100 Subject: [PATCH] :zap: Add minor optimization for d/without-qualified helper --- backend/src/app/rpc.clj | 8 +++++--- common/src/app/common/data.cljc | 7 ++++++- common/src/app/common/media.cljc | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/src/app/rpc.clj b/backend/src/app/rpc.clj index 08ccd8cdb..2f999a08e 100644 --- a/backend/src/app/rpc.clj +++ b/backend/src/app/rpc.clj @@ -149,9 +149,11 @@ (let [params (decode params)] (if (validate params) (f cfg params) - (ex/raise :type :validation - :code :params-validation - ::sm/explain (explain params)))))) + + (let [params (d/without-qualified params)] + (ex/raise :type :validation + :code :params-validation + ::sm/explain (explain params))))))) f)) (defn- wrap-output-validation diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 958a3b9b0..bcfd55648 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -242,7 +242,12 @@ ([] (remove (comp qualified-keyword? key))) ([data] - (into {} (without-qualified) data))) + (reduce-kv (fn [data k _] + (if (qualified-keyword? k) + (dissoc data k) + data)) + data + data))) (defn without-keys "Return a map without the keys provided diff --git a/common/src/app/common/media.cljc b/common/src/app/common/media.cljc index 064f11fb2..212d43f2a 100644 --- a/common/src/app/common/media.cljc +++ b/common/src/app/common/media.cljc @@ -58,6 +58,7 @@ "application/zip" ".zip" "application/penpot" ".penpot" "application/pdf" ".pdf" + "text/plain" ".txt" nil)) (s/def ::id uuid?)