2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 16:39:32 +00:00

Parse SMM answers as bytes, not as decoded text

lxml refuses a str carrying an encoding declaration, and the SMM declares one
when it answers /data/login, so _webconfigcreds has raised ValueError on the
first thing it does after logging in ever since the switch to lxml. stdlib
ElementTree took the same input, which is why it went unnoticed. fromstring
already means to take either shape, so encode there. Confirmed against a
DW612S.
This commit is contained in:
Markus Hilger
2026-08-10 14:04:31 +02:00
parent 4fe1532da9
commit e6f6b2330f
@@ -38,6 +38,10 @@ def fromstring(inputdata):
# The measures above should filter out the risky facets of xml
# We don't need sophisticated feature support
parser = etree.XMLParser(resolve_entities=False, no_network=True, huge_tree=False)
if not isinstance(inputdata, bytes):
# lxml refuses a str that declares an encoding, and the SMM declares
# one when answering a login
inputdata = inputdata.encode('utf8')
return etree.fromstring(inputdata, parser=parser)
def fixuuid(baduuid):