Fix NoneType error in fetch_vulnerabilities and improve request_post#2094
Closed
rishabh23rohil wants to merge 1 commit into
Closed
Fix NoneType error in fetch_vulnerabilities and improve request_post#2094rishabh23rohil wants to merge 1 commit into
rishabh23rohil wants to merge 1 commit into
Conversation
- Handle None return from bulk_search_by_purl() in fetch_vulnerabilities(). When VulnerableCode API returns an error, request_post() returns None, which causes TypeError when iterated. Added a guard to skip failed batches. - Add missing docstring to request_post() for consistency with request_get(). - Add debug logging to request_post() matching the pattern used in request_get(). Signed-off-by: Rishabh Rohil <rishabh23rohil@gmail.com> Signed-off-by: Rishabh Rohil <rishabhrohil024@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Handle
Nonereturn frombulk_search_by_purl()infetch_vulnerabilities(). When VulnerableCode API returns an error,request_post()returnsNone, which causesTypeError: 'NoneType' object is not iterablewhen iterated on line 226. Added a guard to skip failed batches gracefully.Add missing docstring to
request_post()for consistency withrequest_get()(line 99).Add debug logging to
request_post()matching the logging pattern used inrequest_get()(line 107).Test plan