Skip to content

fix(transformer): don't ignore the entity after a stray '&'#13554

Merged
overlookmotel merged 1 commit intooxc-project:mainfrom
s7tya:fix-entity-after-stray-amp
Sep 6, 2025
Merged

fix(transformer): don't ignore the entity after a stray '&'#13554
overlookmotel merged 1 commit intooxc-project:mainfrom
s7tya:fix-entity-after-stray-amp

Conversation

@s7tya
Copy link
Contributor

@s7tya s7tya commented Sep 5, 2025

Fixes #13546

Currently, an input like & &, which should be transformed into & &, is incorrectly treated as a single entity. As a result, the output becomes & &.

This PR fixes the issue by resetting the start index when the decoder encounters another & before a ;.

Copilot AI review requested due to automatic review settings September 5, 2025 08:43
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 5, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-bug Category - Bug labels Sep 5, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the JSX entity decoder where stray ampersands (&) would interfere with proper entity decoding. The issue occurred when an input like & & was incorrectly treated as a single entity instead of a stray & followed by a valid & entity.

  • Updates the entity decoder to reset the start index when encountering another & before finding a ;
  • Adds a test case to verify the fix for the stray ampersand scenario

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@s7tya s7tya marked this pull request as draft September 5, 2025 09:05
@s7tya s7tya marked this pull request as ready for review September 5, 2025 09:35
@s7tya s7tya force-pushed the fix-entity-after-stray-amp branch from 8e21367 to 7f7be0d Compare September 5, 2025 09:43
Copy link
Member

@overlookmotel overlookmotel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for tackling this. Sorry that Copilot called your elegant solution into question!

Note: Boshen assigned Dunqing to this issue, but Dunqing and I had already discussed the other day. As I was the last to touch this code, I said I'd look at it first.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 6, 2025

CodSpeed Instrumentation Performance Report

Merging #13554 will not alter performance

Comparing s7tya:fix-entity-after-stray-amp (7f7be0d) with main (1425da2)1

Summary

✅ 37 untouched benchmarks

Footnotes

  1. No successful run was found on main (e1adb0f) during the generation of this report, so 1425da2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Sep 6, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 6, 2025

Merge activity

  • Sep 6, 2:13 PM UTC: @s7tya we removed the merge queue label because we could not find a Graphite account associated with your GitHub profile.

You must have a Graphite account in order to use the merge queue. Create an account and try again using this link

@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 6, 2025
@overlookmotel overlookmotel merged commit 26ab087 into oxc-project:main Sep 6, 2025
25 checks passed
@robw-mercury
Copy link

Thank you all for addressing this so quickly!

Copilot AI pushed a commit that referenced this pull request Sep 8, 2025
Fixes #13546

Currently, an input like `& &`, which should be transformed into `&
&`, is incorrectly treated as a single entity. As a result, the output
becomes `& &`.

This PR fixes the issue by resetting the start index when the decoder
encounters another `&` before a `;`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jsx transform: bare & breaks following html entity replacement

5 participants