_getJSONLD
doesn't handle context objects
#934
Labels
metadata
Issues with the metadata generated by readability
_getJSONLD
doesn't handle context objects
#934
For example this json-ld from https://www.nbcnews.com/news/world/south-korea-martial-law-president-yoon-suk-yeol-impeachment-vote-rcna183138 fails with
Reader: (Readability) [email protected] is not a function
:The problematic code is this, which assumes
parsed["@context"]
will always be a string, never an object:The quick fix to at least avoid the error would be:
if ( !parsed["@context"] || + !(typeof parsed["@context"] === "string") || !parsed["@context"].match(/^https?\:\/\/schema\.org$/) ) { return; }
To support objects in addition to strings:
The text was updated successfully, but these errors were encountered: