digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.66k stars 195 forks source link

Relative URLs in an `@list` can produce bad RDF #382

Open dlongley opened 4 years ago

dlongley commented 4 years ago

Because the _objectToRDF returns null for objects that are relative URLs, and the following code within _listToRDF does not check for this, it's possible that quads are added to the dataset that have null objects, which is invalid. Checks for null objects need to be added here:

https://github.com/digitalbazaar/jsonld.js/blob/master/lib/toRdf.js#L169 https://github.com/digitalbazaar/jsonld.js/blob/master/lib/toRdf.js#L188

To avoid later potential crashes/problems when the dataset is processed (by whatever code).