git2jss
git2jss copied to clipboard
ElementTree errors on parsing "&"
Receive the error: File "/usr/local/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML parser.feed(text) xml.etree.ElementTree.ParseError: reference to invalid character number: line 35, column 20
While trying to download and/or parse our scripts. It seems to be only breaking on &
. I have been doing some research on how to mitigate this. The only thing I could see is to read the XML for each line and handle the &
before the ElementTree gets it.
Figured it out, have to replace any &
with &
. I will do a PR with my fix :)
I think this issue may already be fixed in the dev branch but not merged in. Can you test the dev branch and see if it is still broken?
Sure thing, will test now
It is the same file in tools/
, I am looking in the dev
branch. Is there another branch the might have this fix?
Nope, I recall a fix for something similar to this made in the past. Looks like this is still an issue. I'm definitely willing to take you up on that offer for a PR. ;)
Figured it out, have to replace any
&
with&
. I will do a PR with my fix :)
In fact, the library xml doesn't read "&". If you see in its code https://lxml.de/api/xml.etree.ElementTree-pysrc.html line 1061 it escapes "&" before writing it into xml.