You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README says that when using parse_file() from parse_anything.py "Unsuccessful parsing will raise SPDXParsingError with a list of all encountered problems." However, other Exceptions can be raised for very badly formed files.
As an example, if the SPDX file is a valid JSON format, and there is a string where an array or object should be, it issues:
AttributeError: 'str' object has no attribute 'get'
In my test case, I took a valid spdx.json file, and replaced a package with a string value:
# self.json_data is valid spdx in json format
bad_spdx = json.loads(self.json_data)
bad_spdx['packages'][0] = 'bad value'
bad_spdx_json = json.dumps(bad_spdx)
with open("spdx.json", 'w') as f:
f.write(bad_spdx_json)
parse_file("spdx.json")
I would expect such a case to raise an SPDXParsingError with an indication like "packages[0] was expected to be an array, but was not"
The text was updated successfully, but these errors were encountered:
The README says that when using parse_file() from parse_anything.py "Unsuccessful parsing will raise SPDXParsingError with a list of all encountered problems." However, other Exceptions can be raised for very badly formed files.
As an example, if the SPDX file is a valid JSON format, and there is a string where an array or object should be, it issues:
In my test case, I took a valid spdx.json file, and replaced a package with a string value:
I would expect such a case to raise an SPDXParsingError with an indication like "packages[0] was expected to be an array, but was not"
The text was updated successfully, but these errors were encountered: