-
Notifications
You must be signed in to change notification settings - Fork 220
Description
while I was working on #578 - which is completely based on "Rules for each purl component", i found some cases that are not properly parsable with the current specced "How to parse a purl string in its components"
non-canonical test case, valid according to spec :
pkg://////foo-type/////bar-namespace////bazz-name/////@version- multiple slashes after the ":" -
purl-spec/PURL-SPECIFICATION.rst
Lines 131 to 132 in c53ba0e
followed by one or more slash '/' characters, such as 'pkg://', and MUST ignore and remove all such '/' characters. - multiple slashes leading and trailing the namespace -
purl-spec/PURL-SPECIFICATION.rst
Lines 149 to 150 in c53ba0e
- All leading and trailing slashes '/' are not significant and SHOULD be stripped in the canonical form. They are not part of the ``namespace``. - multiple slashes leading and trailing the name -
purl-spec/PURL-SPECIFICATION.rst
Lines 168 to 169 in c53ba0e
- All leading and trailing slashes '/' are not significant and SHOULD be stripped in the canonical form. They are not part of the ``name``.
- multiple slashes after the ":" -
- ... add other cases here ...
parsing pkg://////foo-type/////bar-namespace////bazz-name/////@version
- split once from right
#- no subpath
- remainder:
pkg://////foo-type/////bar-namespace////bazz-name/////@version
- split once from right
?- no qualifiers
- remainder:
pkg://////foo-type/////bar-namespace////bazz-name/////@version
- split once left on
:- schema:
pkg - remainder //////foo-type/////bar-namespace////bazz-name/////@Version
- schema:
- strip leading/trailing slashes
- result:
foo-type/////bar-namespace////bazz-name/////@version
- result:
- split once left of
/- type: foo-type
- remainder:
////bar-namespace////bazz-name/////@version
- split once from right on
@- version:
version - remainder:
////bar-namespace////bazz-name/////
- version:
- split remainder once from right on
/- remainder:
////bar-namespace////bazz-name//// - name: `` (empty string)
- remainder:
looks like the following instructions is placed at the wrong position:
- Strip all leading and trailing '/' characters (e.g., '/', '//', '///' and
so on) from theremainder
instead, at this position, it would be enough to strip leading slashes,
and in addition, the strip of leading and trailing slashes is needed for name/namespace