Skip to content

[Bug] Uppercase HTML named entities are not decoded in meta-fetcher #314

Closed

Description

@anurag2787

Describe the bug
The decodeEntities function in src/lib/meta-fetcher.ts fails to decode uppercase HTML entities such as &, ", and <. The regex matches these entities, but the lookup fails because the entity names are not converted to lowercase

To Reproduce
Steps to reproduce the behavior:

  1. Run the following code:
import { parseMetaTags } from '@/lib/meta-fetcher';

const tags = parseMetaTags(
  '<title>Tom &AMP; Jerry</title>',
  'https://example.com'
);

console.log(tags.title);2. Click on '...'
  1. Check the output.

Expected behavior
The title should be decoded correctly: Tom & Jerry

Actual behavior
The output retains the uppercase entity instead of decoding it: Tom &AMP; Jerry

Activity

  1. anurag2787 commented on Oct 29, 2026

    @anurag2787
    CollaboratorAuthor

    Hi @anurag629 if this issue is valid can I work on it?

  2. anurag629 commented on Oct 29, 2026

    @anurag629
    Member

    Hey @anurag2787, confirmed too, with one note on the fix: entity names are case-sensitive, and HTML only has uppercase forms of &AMP;, &LT;, &GT; and &QUOT; (there's no &APOS; or &NBSP;). So add those four to NAMED_ENTITIES rather than lowercasing the name, or &Amp; and &NBSP; would get decoded when browsers leave them alone. You're at two with #304 and #313 right now, so this one's yours once #312 is merged, just say so here.

  3. srikar-naidu commented on Oct 29, 2026

    @srikar-naidu
    Collaborator

    @anurag629 @anurag2787 , can i take this if it's free

  4. anurag2787 commented on Oct 30, 2026

    @anurag2787
    CollaboratorAuthor

    Hi @anurag629 could you please assign this to me now?

  5. anurag629 commented on Oct 30, 2026

    @anurag629
    Member

    Hey @srikar-naidu, this one's going to @anurag2787 since they found it, sorry.

  6. anurag2787 commented on Oct 30, 2026

    @anurag2787
    CollaboratorAuthor

    Hi @anurag629 you forgot to assign me but i raised a PR for it #317

  7. anurag629 commented on Oct 30, 2026

    @anurag629
    Member

    Sorry about that @anurag2787, assigned now. I'll look at #317 next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghacktoberfestGood pick for Hacktoberfest contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions