Uh oh!
There was an error while loading. Please reload this page.
fix: escape / in names and versions - #123
Conversation
matt-phylum
commented
Feb 27, 2024
AFAIK
The tests come from https://github.com/package-url/purl-spec/blob/master/test-suite-data.json . |
jkugler
commented
Apr 26, 2024
Yes, I would say the spec is somewhat ambiguous. The spec does say this:
The second line refers to the separator. And given that the name must be a percent-encoded string, I would think a |
matt-phylum
commented
Apr 26, 2024
I mean, I don't think there's a package type which allows slashes in the name, and I don't think it would be a good idea to make a package type that would include slashes in the name. The implementations should do something consistent and the tests in the spec should specify what that is. |
jkugler
commented
Apr 26, 2024
In the spec, no, there isn't a package type that has |
jkugler
commented
Apr 26, 2024
Just thought of another use case that might want slashes in the name. If a company is using a monorepo with multiple product in one repo, you might have, say, github/org/repo_name/product_name where the actual name would be "repo_name/product_name." |
| if name: | ||
| name = name.replace("/", "%2F") | ||
| if version: | ||
| version = version.replace("/", "%2F") |
There was a problem hiding this comment.
These should actually use urllib.parse.quote(the_string, safe='')
pombredanne
commented
Apr 9, 2025
Thanks for all this. We are in the last leg of clarifying the encoding of namespace/name and version in the spec and I'll review this as soon as this is completed! |
martonilles
commented
Feb 25, 2026
In ECMA-427
According to this name could contain any unicode, including slash ( Currently it is broken on a roundtrip: One way is OK: |
This will properly escape slashes in both names and versions of packages.
In addition, I've synced the tests with the ones in https://github.com/package-url/packageurl-dotnet.