Skip to content

Conversation

@matt-phylum
Copy link
Collaborator

Overview

I was looking at package-url/packageurl-python#123 and found a case where parsing the canonical PURL requires following almost exactly the parsing algorithm described in the spec.

We need to be doing more rsplits and we need to rsplit the version from the name before rsplitting the name from the namespace. Otherwise, if the version contains a slash we get the wrong result.

The format test was ensuring slashes in the version were percent encoded, which is not part of the spec, but was required to be able to parse the resulting PURL string when using the incorrect parsing algorithm. I moved it into our test json so it covers both directions and we test deserialization for both the properly escaped and improperly escaped cases (followup PR for better coverage).

Checklist

  • Does this PR have an associated issue?
  • Have you ensured that you have met the expected acceptance criteria?
  • Have you created sufficient tests?

Issue

What issue(s) does this PR close. Use the closes #<issueNum> here.

Copy link

@Allan-Clements Allan-Clements left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matt-phylum matt-phylum merged commit 7aa82fa into main Feb 27, 2024
@matt-phylum matt-phylum deleted the matt/order branch February 27, 2024 17:14
@matt-phylum matt-phylum mentioned this pull request Apr 26, 2024
3 tasks
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.

3 participants