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 f76ec22 commit ffefe07Copy full SHA for ffefe07
plexapi/utils.py
@@ -726,8 +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)
731
- return ElementTree.fromstring(encoded_s)
+ return ElementTree.fromstring(s.encode('utf-8'))
732
except ElementTree.ParseError: # If it fails, clean the string and try again
733
- return ElementTree.fromstring(cleanXMLString(encoded_s))
+ cleaned_s = cleanXMLString(s).encode('utf-8')
+ return ElementTree.fromstring(cleaned_s) if cleaned_s.strip() else None
0 commit comments