Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Trim ld+json before parsing #254

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

rnystrom
Copy link
Contributor

@rnystrom rnystrom commented Dec 3, 2024

Some sites that I'm parsing OG data on have empty LD+JSON. This crashes in JSON.parse. The fix is simply to trim the content before parsing, which results in a no-op.

@jshemas
Copy link
Owner

jshemas commented Dec 3, 2024

Great catch! Thanks for the PR.

@jshemas jshemas merged commit 40a50e0 into jshemas:master Dec 3, 2024
4 checks passed
@jshemas
Copy link
Owner

jshemas commented Dec 4, 2024

Changes are live in open-graph-scraper@6.8.3

@rnystrom rnystrom deleted the rn/ld-json-whitespace branch December 4, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants