Skip to content

Commit 7f2d83b

Browse files
ndr-brtdavidlehn
authored andcommitted
fix: incorrect @id expansion
1 parent 7b64cd0 commit 7f2d83b

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ coverage
1414
dist
1515
node_modules
1616
npm-debug.log
17+
package-lock.json
1718
tests/webidl/*-new
1819
v8.log

lib/url.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ 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;
112114
}
113115
path += rel.path;
114116

tests/misc.js

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

14961497
describe('values', () => {
@@ -2816,6 +2817,37 @@ _:b0 <ex:p> "[null]"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .
28162817
});
28172818
});
28182819

2820+
it('should be called on relative IRI for id term [4]', async () => {
2821+
const input =
2822+
{
2823+
"@id": "34:relativeiri",
2824+
"urn:test": "value"
2825+
}
2826+
;
2827+
const expected =
2828+
[
2829+
{
2830+
"@id": "34:relativeiri",
2831+
"urn:test": [
2832+
{
2833+
"@value": "value"
2834+
}
2835+
]
2836+
}
2837+
]
2838+
;
2839+
2840+
await _test({
2841+
type: 'expand',
2842+
input,
2843+
expected,
2844+
eventCodeLog: [
2845+
'relative @id reference'
2846+
],
2847+
testNotSafe: true
2848+
});
2849+
});
2850+
28192851
it('should be called on relative IRI for id term (nested)', async () => {
28202852
const input =
28212853
{

0 commit comments

Comments
 (0)