Skip to content

Conversation

@dwalluck
Copy link
Contributor

The spec says that keys are case insensitive and that the canonical form is lowercase. This means that the parser should accept any case, but treat all variations as the same key.

@dwalluck
Copy link
Contributor Author

A key is case insensitive. The canonical form is lowercase

This seems to say that keys of any case are allowed, but should be treated as identical.

If the qualifiers are not empty and not composed only of key/value pairs where the value is empty:

Append '?' to the purl
Build a list from all key/value pair:

Discard any pair where the value is empty.

This seems to say that empty values are allowed, but discarded.

This poses a problem for the builder. Should it allow you to add null or "" keys and just have it be a no-op? I think so, so those tests had to be changed. It is the PackageURL constructor which currently does the qualifier cleanup. The builder doesn't contain any validation or cleanup logic.

In any case, you still have some weird behavior since adding entry { "FOO" : "bar" } is legal, but purl.getQualifiers().get("FOO") is null while purl.getQualifiers().get("foo") is "bar".

It's possibly best that a future API just allow something like purl.getQualifier("foO") to always return "bar" (a case insensitive map, essentially).

Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

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

Looks almost good to me.

@jeremylong
Copy link
Collaborator

@dwalluck mind fixing the merge conflicts on this one? Sorry that we are getting to these late and thus causing so many merge conflicts.

@dwalluck dwalluck force-pushed the allow-uppercase-map-keys branch 2 times, most recently from 1494768 to d4a8204 Compare March 10, 2025 15:29
@dwalluck dwalluck force-pushed the allow-uppercase-map-keys branch from d4a8204 to 318b8eb Compare March 10, 2025 15:34
Copy link
Collaborator

@jeremylong jeremylong left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremylong jeremylong merged commit b2f26f8 into package-url:master Mar 11, 2025
2 checks passed
@dwalluck dwalluck deleted the allow-uppercase-map-keys branch March 12, 2025 13:09
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