Skip to content

Commit d0b8330

Browse files
authored
Merge pull request package-url#456 from ppkarwasz/feat/path-parser-subpath
Subpath: simplify parsing
2 parents 19a4965 + 2e760e3 commit d0b8330

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

docs/how-to-parse.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ To parse a `purl` string in its components:
1111
- Split the `purl` string once from right on '#'
1212

1313
- The left side is the `remainder`
14-
- Strip the right side from leading and trailing '/'
15-
- Split this on '/'
16-
- Discard any empty string segment from that split
14+
- Split the right side on `/`
1715
- Percent-decode each segment
18-
- Discard any '.' or '..' segment from that split
1916
- UTF-8-decode each segment if needed in your programming language
17+
- Discard any segment that is empty, or equal to `.` or `..`
18+
- Report an error if any segment contains a slash `/`
2019
- Join segments back with a '/'
2120
- This is the `subpath`
2221

0 commit comments

Comments
 (0)