Skip to content

Commit 7a12324

Browse files
committed
fix: escape attributes
Following will be escaped from now on - angle brackets - quotes - ampersands - and a mix of them too
1 parent 18ce10c commit 7a12324

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

json2xml/dicttoxml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def make_attrstring(attr: dict[str, Any]) -> str:
127127
Returns:
128128
str: The string of XML attributes.
129129
"""
130-
attrstring = " ".join([f'{k}="{v}"' for k, v in attr.items()])
130+
attrstring = " ".join([f'{k}="{escape_xml(v)}"' for k, v in attr.items()])
131131
return f'{" " if attrstring != "" else ""}{attrstring}'
132132

133133

0 commit comments

Comments
 (0)