File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 22
33### Fixed
44- More support for ` "@type": "@none" ` .
5+ - JSON literal value handling issues (` null ` and ` [] ` ).
56
67### Added
78- Support for extracting JSON-LD from HTML, when the xmldom package is loaded.
Original file line number Diff line number Diff line change @@ -87,8 +87,8 @@ module.exports = ({
8787
8888 // handle Link Header (avoid unsafe header warning by existence testing)
8989 let linkHeader ;
90- if ( REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) &&
91- contentType !== 'application/ld+json' ) {
90+ if ( contentType !== 'application/ld+json' &&
91+ REGEX_LINK_HEADER . test ( req . getAllResponseHeaders ( ) ) ) {
9292 linkHeader = req . getResponseHeader ( 'Link' ) ;
9393 }
9494 if ( linkHeader && contentType !== 'application/ld+json' ) {
Original file line number Diff line number Diff line change @@ -935,16 +935,17 @@ jsonld.get = async function(url, options) {
935935 }
936936 } catch ( e ) {
937937 if ( e . name === 'jsonld.InvalidScriptElement' ) {
938+ // pass error detected in HTML decode
938939 throw ( e ) ;
939- } else {
940- throw new JsonLdError (
941- 'Could not retrieve a JSON-LD document from the URL.' ,
942- 'jsonld.LoadDocumentError' , {
943- code : 'loading document failed' ,
944- cause : e ,
945- remoteDoc
946- } ) ;
947940 }
941+ // otherwise, general loading error
942+ throw new JsonLdError (
943+ 'Could not retrieve a JSON-LD document from the URL.' ,
944+ 'jsonld.LoadDocumentError' , {
945+ code : 'loading document failed' ,
946+ cause : e ,
947+ remoteDoc
948+ } ) ;
948949 }
949950
950951 return remoteDoc ;
You can’t perform that action at this time.
0 commit comments