If we expand a URI with "@base" not ending with a "/", we get a URI missing the last path fragment.
For example
"@base":"http://example.com/loutre" with"@id":"toto" gives http://example.com/toto when we would expect http://example.com/loutre/toto. If "@base" ends with a "/" it works fine.
This issue is only on URI expansion, but the behaviour is different on URI compaction : a "@base" with or without "/" will give the same URI fragment.
This will be a problem when round-tripping because the input URI will change after re-expansion.
Input: "@id":"http://example.com/loutre/toto"
Compaction with "@base":"http://example.com/loutre" gives
If we expand a URI with "@base" not ending with a "/", we get a URI missing the last path fragment. For example
"@base":"http://example.com/loutre"
with"@id":"toto"
giveshttp://example.com/toto
when we would expecthttp://example.com/loutre/toto
. If "@base" ends with a "/" it works fine.Playground expansion without "/"
Playground expansion with "/"
This issue is only on URI expansion, but the behaviour is different on URI compaction : a "@base" with or without "/" will give the same URI fragment. This will be a problem when round-tripping because the input URI will change after re-expansion.
Input:
"@id":"http://example.com/loutre/toto"
Compaction with"@base":"http://example.com/loutre"
givesWhich re-expanded gives
"http://example.com/toto"
.Playground compaction, "@base" without "/"
Proposed fix: https://github.com/ethieblin/jsonld.js/pull/2