Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions PURL-SPECIFICATION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,14 @@ The rules for each component are:
- The ``subpath`` string is prefixed by a '#' separator when not empty
- This '#' is not part of the ``subpath``
- The ``subpath`` contains zero or more segments, separated by slash '/'
- Leading and trailing slashes '/' are not significant and should be stripped
- Leading and trailing slashes '/' are not significant and SHOULD be stripped
in the canonical form
- Each ``subpath`` segment must be a percent-encoded string
- Each ``subpath`` segment MUST be a percent-encoded string
- When percent-decoded, a segment:

- must not contain a '/'
- must not be any of '..' or '.'
- must not be empty

- The ``subpath`` must be interpreted as relative to the root of the package
- MUST NOT contain a '/'
- MUST NOT be any of '..' or '.'
- MUST NOT be empty
- The ``subpath`` MUST be interpreted as relative to the root of the package


Character encoding
Expand Down Expand Up @@ -343,8 +341,8 @@ To parse a ``purl`` string in its components:
- Strip the right side from leading and trailing '/'
- Split this on '/'
- Discard any empty string segment from that split
- Discard any '.' or '..' segment from that split
- Percent-decode each segment
- Discard any '.' or '..' segment from that split
Copy link
Member Author

Choose a reason for hiding this comment

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

percent decode first, then discard ../..
see the tests in accordance #368

Copy link
Member

Choose a reason for hiding this comment

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

LGTM!

- UTF-8-decode each segment if needed in your programming language
- Join segments back with a '/'
- This is the ``subpath``
Expand Down