[Bug] Update Rule Formatter (#3668)

* Update Rule Formatter

* Only apply fix to Note

(cherry picked from commit 094ef22604)
This commit is contained in:
Eric Forte
2024-05-13 15:00:01 -04:00
committed by github-actions[bot]
parent 2f88a93d62
commit e45c7db95e
+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):