fix: treat special chars as invalid properties instead

pull/6529/head
Tienson Qin 2022-09-22 14:15:48 +08:00
parent 39b7f1bb45
commit 1830b0c082
2 changed files with 6 additions and 3 deletions

View File

@ -197,8 +197,7 @@
k)
k (-> (string/lower-case k)
(string/replace " " "-")
(string/replace "_" "-")
(string/replace #"[\"|^|(|)|{|}]+" ""))]
(string/replace "_" "-"))]
(if (gp-property/valid-property-name? (str ":" k))
(let [k' (keyword
(if (contains? #{"custom_id" "custom-id"} k)

View File

@ -15,7 +15,11 @@
(map #(str (name (key %)) (str colons " ") (val %)))
(string/join "\n")))
(def valid-property-name? gp-util/valid-edn-keyword?)
(defn valid-property-name?
[s]
[:pre (string? s)]
(and (gp-util/valid-edn-keyword? s)
(not (re-find #"[\"|^|(|)|{|}]+" s))))
(defn properties-ast?
[block]