🐛 Sanitize inputs for variant property names and values (#6532)

This commit is contained in:
luisδμ 2025-05-23 12:08:39 +02:00 committed by GitHub
parent 44829ff1ae
commit a9173f672d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -286,7 +286,8 @@
(mf/use-fn
(mf/deps component-ids)
(fn [pos value]
(let [value (if (= value empty-indicator) "" value)]
(let [value (str/trim value)
value (if (= value empty-indicator) "" value)]
(doseq [id component-ids]
(st/emit! (dwv/update-property-value id pos value))
(st/emit! (dwv/update-error id nil))))))
@ -295,11 +296,12 @@
(mf/use-fn
(mf/deps variant-id)
(fn [event]
(let [value (dom/get-target-val event)
(let [value (str/trim (dom/get-target-val event))
pos (-> (dom/get-current-target event)
(dom/get-data "position")
int)]
(st/emit! (dwv/update-property-name variant-id pos value)))))]
(when (seq value)
(st/emit! (dwv/update-property-name variant-id pos value))))))]
[:*
[:div {:class (stl/css :variant-property-list)}