From 19d52c178b954264abd0f79120a0b65fa50b6078 Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Thu, 3 Aug 2023 11:17:16 -0400 Subject: [PATCH] fix: still disallow invalid property names Issues with using tag or page ref syntax on pages still exist with db graphs --- src/main/frontend/components/property.cljs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/frontend/components/property.cljs b/src/main/frontend/components/property.cljs index c5464391d8..4011591057 100644 --- a/src/main/frontend/components/property.cljs +++ b/src/main/frontend/components/property.cljs @@ -360,11 +360,15 @@ (exit-edit-property)) (let [editor-id (str "ls-property-" blocks-container-id (:db/id entity) "-" (:db/id property))] (set-editing! property editor-id "" ""))) - (do - (db-property/upsert-property! repo value {:type :default} {}) - ;; configure new property - (when-let [property (get-property-f value)] - (state/set-sub-modal! #(property-config repo property))))))})]))) + (if (gp-property/valid-property-name? (str ":" value)) + (do + (db-property/upsert-property! repo value {:type :default} {}) + ;; configure new property + (when-let [property (get-property-f value)] + (state/set-sub-modal! #(property-config repo property)))) + (do (notification/show! "This is an invalid property name. A property name cannot start with non-alphanumeric characters e.g. '#' or '[['." :error) + (reset! *property-key nil) + (exit-edit-property)))))})]))) (rum/defcs new-property < rum/reactive (rum/local nil ::property-key)