diff --git a/swh/indexer/metadata_dictionary/nuget.py b/swh/indexer/metadata_dictionary/nuget.py --- a/swh/indexer/metadata_dictionary/nuget.py +++ b/swh/indexer/metadata_dictionary/nuget.py @@ -51,11 +51,7 @@ return [] def translate(self, content: bytes) -> Optional[Dict[str, Any]]: - d = ( - xmltodict.parse(content.strip(b" \n ")) - .get("package", {}) - .get("metadata", {}) - ) + d = xmltodict.parse(content).get("package", {}).get("metadata", {}) if not isinstance(d, dict): self.log.warning("Skipping ill-formed XML content: %s", content) return None diff --git a/swh/indexer/tests/metadata_dictionary/test_nuget.py b/swh/indexer/tests/metadata_dictionary/test_nuget.py --- a/swh/indexer/tests/metadata_dictionary/test_nuget.py +++ b/swh/indexer/tests/metadata_dictionary/test_nuget.py @@ -10,8 +10,7 @@ def test_compute_metadata_nuget(): - raw_content = b""" - + raw_content = b""" sample @@ -105,8 +104,7 @@ def test_normalize_license_multiple_licenses_or_delimiter(): - raw_content = raw_content = b""" - + raw_content = raw_content = b""" BitTorrent-1.0 or GPL-3.0-with-GCC-exception @@ -129,8 +127,7 @@ def test_normalize_license_unsupported_delimiter(): - raw_content = raw_content = b""" - + raw_content = raw_content = b""" (MIT) @@ -149,8 +146,7 @@ def test_copyrightNotice_absolute_uri_property(): - raw_content = raw_content = b""" - + raw_content = raw_content = b""" Copyright 2017-2022