Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unavailable URLs returned by purl2url on GitHub PURLs #42

Closed
tdruez opened this issue Aug 14, 2020 · 2 comments
Closed

Unavailable URLs returned by purl2url on GitHub PURLs #42

tdruez opened this issue Aug 14, 2020 · 2 comments

Comments

@tdruez
Copy link
Collaborator

tdruez commented Aug 14, 2020

>>> from packageurl.contrib import purl2url
>>> purl2url.purl2url('pkg:github/package-url/packageurl-python@0.9.1')
'https://github.com/package-url/packageurl-python/tree/0.9.1'

The returned URL https://github.com/package-url/packageurl-python/tree/0.9.1 leads to a 404.
The proper URL is actually https://github.com/package-url/packageurl-python/tree/v0.9.1 with the "v" prefix.

Note that the "v" prefix in a tag name is a convention and optional.

@scovetta
Copy link

Hi @tdruez I think the issue here is that the "version" for GitHub is taken to mean a tag, so your purl should actually contain the "v" prefix here, specifically because the packageurl-python project uses "v" as a prefix for tags.

>>> purl2url.purl2url('pkg:github/package-url/packageurl-python@v0.9.1')
'https://github.com/package-url/packageurl-python/tree/v0.9.1'

Other projects, like Python-Pillow, use just the raw version number, so this works as expected:

>>> purl2url.purl2url('pkg:github/python-pillow/Pillow@7.2.0')
'https://github.com/python-pillow/pillow/tree/7.2.0'

tdruez added a commit that referenced this issue Oct 14, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 14, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 14, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 14, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 14, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 17, 2022
Qualifier `download_url` is now supported in build_github_download_url

Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 17, 2022


Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 17, 2022
Signed-off-by: Thomas Druez <tdruez@nexb.com>
tdruez added a commit that referenced this issue Oct 17, 2022
* Refactor purl2url into get_repo_url and get_download_url #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Add support for nuget in purl2url.get_download_url #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Add get_inferred_urls function to return all inferred URLs #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Include the `version_prefix` as a qualifier to infer valid URLs #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Fix formatting with black #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Add support for qualifiers in purl_from_pattern #42

Qualifier `download_url` is now supported in build_github_download_url

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Return the download_url qualifier when available in get_download_url #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>

* Add changelog entry #42

Signed-off-by: Thomas Druez <tdruez@nexb.com>
@tdruez
Copy link
Collaborator Author

tdruez commented Oct 17, 2022

The version prefix is now kept as a version_prefix qualifier in url2purl. This allows to generate valid URLs in purl2url.
We choose this approach instead of keeping the prefix in the @ version for maximum compatibility across existing PURLs.

@tdruez tdruez closed this as completed Oct 17, 2022
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

No branches or pull requests

2 participants