Skip to content

_getJSONLD doesn't handle https://schema.org/ with trailing / #936

@danielnixon

Description

@danielnixon

Example: https://www.theparisreview.org/fiction/8364/camouflage-adania-shibli

On that site, Readability fails to extract the author, despite it being in the json-ld:

{
	"@context": "https://schema.org/",
	"@type": "Article",
	"name": "Camouflage",
	"author": {
		"@type": "Person",
		"name": "Adania Shibli, translated by Max Weiss"
	},

The problem is the regex that Readability uses to match against the @context matches https://schema.org but it doesn't match https://schema.org/.

Updating the regex as follows (additional \/?) fixes the issue:

/^https?\:\/\/schema\.org\/?$/

Metadata

Metadata

Assignees

No one assigned

    Labels

    metadataIssues with the metadata generated by readability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions