Repository navigation
fix: keep apostrophes and decode html entities in meta tags - #134
Merged
Merged
Conversation
Quoted values stopped at the first quote of either kind, and only six named entities were decoded, so titles like the Wikipedia one showed a raw &codercops#39;.
anurag629
approved these changes
Oct 15, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @prakashNalla, this covers all of #106, and fast too. I merged it onto current dev: npm run check is clean, all 242 tests pass, and against the old parser with only the export added, 7 of your 8 new tests fail. The unknown entity one passes either way, like you wrote. Merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
parseAttributesnow matches each value up to the same quote it opened with, socontent="Don't Panic"andcontent='The "best" guide'come back in full.decodeEntitiesis a single pass over named entities (&,<,>,",', ) plus decimal and hex numeric ones, so&lt;becomes<and unknown entities are left as they are.parseMetaTagsis exported and the placeholder test is replaced with real cases.Closes #106
How I Tested This
npm ci,npm run check(0 errors, 0 warnings, 10 existing hints),npm run test(19 files / 242 tests pass),npm run build, all on Node v22.23.3parseMetaTagstests against the old parser (with only the export added): 7 of the 8 fail. The unknown-entity case passes on both.npm run dev, then/api/previewwith the Wikipedia link from the issue returns"ogTitle":"The Hitchhiker's Guide to the Galaxy - Wikipedia"(the live site still returns').AI Assistance
Claude helped me understand the issue & I wrote the fix & tests.
Type of Change
Screenshots
N/A, parser change. Covered by the new tests and the
/api/previewoutput above.Checklist
devnpm run checkpassesnpm run testpassesnpm run dev