Skip to content

Commit cf26930

Browse files
committed
Fix relative IRI parsing.
- Undo previous "protocol" fix for `123:abc` style relative IRIs. - Update IRI parser to be more strict for RFC3986 URI schemes.
1 parent 7f2d83b commit cf26930

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Fix safe mode for `@graph` use cases.
88
- Check all elements of graph property with array.
99
- Fix test `pr41` of protected redefinition of equivalent id terms.
10+
- Fix relative IRI parsing.
1011

1112
## 8.2.0 - 2023-05-19
1213

lib/url.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ api.parsers = {
2828
'hostname', 'port', 'path', 'directory', 'file', 'query', 'fragment'
2929
],
3030
/* eslint-disable-next-line max-len */
31-
regex: /^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
31+
regex: /^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
3232
}
3333
};
3434
api.parse = (str, parser) => {
@@ -109,8 +109,6 @@ api.prependBase = (base, iri) => {
109109
path = path.substr(0, path.lastIndexOf('/') + 1);
110110
if((path.length > 0 || base.authority) && path.substr(-1) !== '/') {
111111
path += '/';
112-
} else if (rel.protocol) {
113-
path += rel.protocol;
114112
}
115113
path += rel.path;
116114

tests/misc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,6 @@ _:b0 <ex:p> "v" .
14911491
testSafe: true
14921492
});
14931493
});
1494-
14951494
});
14961495

14971496
describe('values', () => {

0 commit comments

Comments
 (0)