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: error overlay message escape #12305

Merged
merged 5 commits into from
Nov 8, 2024
Merged

Conversation

florian-lefebvre
Copy link
Member

Copy link

changeset-bot bot commented Oct 25, 2024

🦋 Changeset detected

Latest commit: f6dc9c2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Oct 25, 2024
@Princesseuh
Copy link
Member

I pushed an alternative fix, I'm not 100% sure of what I'm doing. It seems like on HMR upgrade, if any of the Vite processing thingy fails, Vite emits an error through the websocket that doesn't go through any of our usual error stuff. My method patches the .send method directly, but perhaps there's another way to do this properly? cc @bluwy

I'll note that Vite lose a lot of information from errors when doing this, so trying to enhance might not even be relevant in the first place as we can't achieve much.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Fix looks good to me. Since any kind of errors can come through viteServer.hot.send(), as long as we normalize it to escape HTML, or handle it in the overlay code, it should be fine.

@florian-lefebvre florian-lefebvre merged commit f5f7109 into main Nov 8, 2024
13 checks passed
@florian-lefebvre florian-lefebvre deleted the fix/error-overlay-escape branch November 8, 2024 15:07
@astrobot-houston astrobot-houston mentioned this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev server error page: HTML in code comments gets rendered in error message (no escaping of <)
4 participants