Avoid crashing on Go package URLs without a version - #235
Open
codewithfourtix wants to merge 2 commits into
Open
Avoid crashing on Go package URLs without a version#235codewithfourtix wants to merge 2 commits into
codewithfourtix wants to merge 2 commits into
Conversation
Signed-off-by: Ali Zulfiqar <codewithfourtix@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change directly addresses the reported crash and adds targeted regression coverage; remaining feedback is limited to minor maintainability improvements.
Pull request overview
Fixes a crash in purl2url.get_download_url() when handling Go package URLs that omit a version, allowing the existing download_url qualifier fallback to work as intended (per #220).
Changes:
- Update the Go download URL builder to return early when
versionis missing (preventingescape_golang_path(None)). - Add regression tests covering unversioned Go purls with and without a
download_urlqualifier.
File summaries
| File | Description |
|---|---|
src/packageurl/contrib/purl2url.py |
Prevents a None version from being passed into Go path escaping by returning early. |
tests/contrib/test_purl2url.py |
Adds regression coverage for unversioned Go purls and qualifier fallback behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Ali Zulfiqar <codewithfourtix@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.
An unversioned Go purl passes
Nonetoescape_golang_path()and crashes. Return early when the version is missing, allowing the existingdownload_urlqualifier fallback to work.Adds regression coverage for unversioned purls with and without a download qualifier. Fixes #220.