-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
If I specify a relative path to a context file I get a jsonld.InvalidUrl error
Steps to reproduce
cd /var/tmp/
curl https://json-ld.org/contexts/person.jsonld -o ./person.jsonld
echo '{ "http://schema.org/telephone": "1323" }' | npx jsonld compact -c ./person.jsonld -
Expected output
{
"@context": "/var/tmp/person.jsonld",
"telephone": "1323"
}
Actual output
jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.
at /home/iwana/.npm-packages/lib/node_modules/jsonld-cli/node_modules/jsonld/lib/context.js:1188:15
Error: {
"name": "jsonld.InvalidUrl",
"details": {
"code": "loading remote context failed",
"url": "/person.jsonld",
"cause": {
"errno": -2,
"code": "ENOENT",
"syscall": "open",
"path": "/person.jsonld"
}
}
}
Notes:
Following works fine:
url to context
echo '{ "http://schema.org/telephone": "1323" }' | npx jsonld compact -c https://json-ld.org/contexts/person.jsonld -
full path to context
curl https://json-ld.org/contexts/person.jsonld -o /var/tmp/person.jsonld
echo '{ "http://schema.org/telephone": "1323" }' | npx jsonld compact -c /var/tmp/person.jsonld -
Downchuck
Metadata
Metadata
Assignees
Labels
No labels