Skip to content

Fix: handle empty response in bulk_search_by_purl to prevent runtime errors#2119

Open
mahakkularia-create wants to merge 1 commit intoaboutcode-org:mainfrom
mahakkularia-create:fix-empty-response-vulnerabilities
Open

Fix: handle empty response in bulk_search_by_purl to prevent runtime errors#2119
mahakkularia-create wants to merge 1 commit intoaboutcode-org:mainfrom
mahakkularia-create:fix-empty-response-vulnerabilities

Conversation

@mahakkularia-create
Copy link
Copy Markdown

Issues

  • Closes: N/A

Changes

The fetch_vulnerabilities function isn't able to handle cases where bulk_search_by_purl may return None or an empty response.
Currently, the code assumes that the response is always iterable, which can lead to runtime errors if the API returns an empty or error response. Therefore I introduced a simple guard condition to skip function when no data is returned.

Checklist

  • [Y ] I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • [Y ] I have reviewed and understood every line of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant