We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 706461d commit f76ec22Copy full SHA for f76ec22
plexapi/utils.py
@@ -726,7 +726,8 @@ def parseXMLString(s: str):
726
""" Parse an XML string and return an ElementTree object. """
727
if not s.strip():
728
return None
729
+ encoded_s = s.encode('utf-8')
730
try: # Attempt to parse the string as-is without cleaning (which is expensive)
- return ElementTree.fromstring(s.encode('utf-8'))
731
+ return ElementTree.fromstring(encoded_s)
732
except ElementTree.ParseError: # If it fails, clean the string and try again
- return ElementTree.fromstring(cleanXMLString(s).encode('utf-8'))
733
+ return ElementTree.fromstring(cleanXMLString(encoded_s))
0 commit comments