Closed phanak-sap closed 2 years ago
The bug stems from LXML trying to parse an non-sanitized XML string. In this case, the '&' needs to be escaped to &
as it would otherwise be considered as the special character, and the parser would fail. https://www.novixys.com/blog/what-characters-need-to-be-escaped-in-xml-documents
This SO thread might be of help https://stackoverflow.com/questions/4972210/escape-unescaped-characters-in-xml-with-python
Incident created on the framework
@prashdsouza Thank you! One of the goals of PyOData was to discover issues in my odata services.
This bug is a false positive - the '&' was correctly escaped, but when bug was reported to me, I received non-escaped version of the XML file, which obviously reproduced the bug.
PR #181 just adds a better exception text for such edge case so the problem would be better understandable to someone who does not know LXML.
Bug reproduced in version: 1.6.0
Environment info: Win 10 Python 3.7.1 pyodata-1.6.0 lxml-4.5.2
Steps to reproduce:
Simplest is to use the script to open local metadata file, e.g. https://github.com/SAP/python-pyodata/blob/master/docs/usage/initialization.rst#get-the-service-with-local-metadata
$metadata content to reproduce the bug
Stacktrace:
Additional Notes:
Metadata are parsed correctly when you delete the '&' characters