Skip to content

Commit adf86fd

Browse files
committed
Collect more data at NugetVersionApi
- Now the class handles paginated results - Added a detailed FIXME comment about an edge case Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent ec3e800 commit adf86fd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

vulnerabilities/package_managers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,12 @@ def nuget_url(pkg_name: str) -> str:
288288
def extract_versions(resp: dict) -> Set[str]:
289289
all_versions = set()
290290
try:
291-
for entry in resp["items"][0]["items"]:
292-
all_versions.add(entry["catalogEntry"]["version"])
293-
# json response for YamlDotNet.Signed triggers this exception
291+
for entry_group in resp["items"]:
292+
for entry in entry_group["items"]:
293+
all_versions.add(entry["catalogEntry"]["version"])
294+
# FIXME: json response for YamlDotNet.Signed triggers this exception.
295+
# Some packages with many versions give a response of a list of endpoints.
296+
# In such cases rather, we should collect data from those endpoints.
294297
except KeyError:
295298
pass
296299

0 commit comments

Comments
 (0)