[Bug] Update Rule Formatter (#3668)

* Update Rule Formatter

* Only apply fix to Note
This commit is contained in:
Eric Forte
2024-05-13 15:00:01 -04:00
committed by GitHub
parent 6150f222b2
commit 094ef22604
+5
View File
@@ -216,6 +216,11 @@ def toml_write(rule_contents, outfile=None):
preserved_fields = ["params.message"]
v = [preserve_formatting_for_fields(action, preserved_fields) for action in v]
if k == 'note' and isinstance(v, str):
# Transform instances of \ to \\ as calling write will convert \\ to \.
# This will ensure that the output file has the correct number of backslashes.
v = v.replace("\\", "\\\\")
if isinstance(v, dict):
bottom[k] = OrderedDict(sorted(v.items()))
elif isinstance(v, list):