Fix whitespace preservation in replacement strings (Issue #8)

This commit is contained in:
BRADSEC
2025-12-20 15:45:27 +10:00
parent a4bf85d9c4
commit c8b45da72e
3 changed files with 64 additions and 4 deletions
+3 -3
View File
@@ -35,13 +35,13 @@ class StringMultiReplaceNode:
# Create a list of all replacements
replacements = []
for line in replacement_pairs.splitlines():
line = line.strip()
if not line or replacement_delimiter not in line:
# Don't strip the line yet to preserve trailing whitespace in replacements (Issue #8)
if not line or line.isspace() or replacement_delimiter not in line:
continue
search_str, replace_str = line.split(replacement_delimiter, 1)
search_str = search_str.strip()
replace_str = replace_str.strip()
# Don't strip replace_str to allow intentional spaces/whitespace (Issue #8)
if not search_str:
continue