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

🐛 BUG: Space in ending tag crashes the compiler #1007

Open
Princesseuh opened this issue May 31, 2024 · 0 comments
Open

🐛 BUG: Space in ending tag crashes the compiler #1007

Princesseuh opened this issue May 31, 2024 · 0 comments
Labels
- P2: has workaround Bug, but has workaround (priority) feat: tsx Related to the TSX output (scope) needs triage Issue needs to be triaged

Comments

@Princesseuh
Copy link
Member

What version of @astrojs/compiler are you using?

2.7.0

What package manager are you using?

pnpm

What operating system are you using?

macOS

Describe the Bug

In HTML, the following code:

<span>Hello</ span>

is invalid, but is corrected by the browser like this:

<span>Hello<!-- span-->
</span>

In the TSX output, writing the first snippet crashes the compiler.

panic: runtime error: index out of range [0] with length 0
goroutine 6 [running]:
github.com/withastro/compiler/internal/printer.renderTsx(0x14bb950, 0x14ad040)
	github.com/withastro/compiler/internal/printer/print-to-tsx.go:248 +0x1b6
github.com/withastro/compiler/internal/printer.renderTsx(0x14bb950, 0x14acdc0)
	github.com/withastro/compiler/internal/printer/print-to-tsx.go:523 +0x52f
github.com/withastro/compiler/internal/printer.renderTsx(0x14bb950, 0x14acb40)
	github.com/withastro/compiler/internal/printer/print-to-tsx.go:147 +0xba
github.com/withastro/compiler/internal/printer.PrintToTSX({0x14920a8, 0x12}, 0x14acb40, {{0x3c3c4, 0x6}, {0x14d20c0, 0x3e}, {0x14d20c0, 0x3e}, {0x46f38, ...}, ...}, ...)
	github.com/withastro/compiler/internal/printer/print-to-tsx.go:30 +0x12
main.main.ConvertToTSX.func3({{}, 0x7ff800010000000d, 0x140c6a0}, {0x1434140, 0x2, 0x2})
	./astro-wasm.go:263 +0xe
syscall/js.hand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gsNzIsMTA4LDYwLDExMCwxMTEsMTc2LDEyOCw0NiwyMjYsNzAsNzIsNTMsMTk5LDIzNiwyNSw5LDEwOSw2NSwyMTUsMjM4LDY5LDkwLDg4LDE3MSwyMjMsMjM4LDksMjU1LDExNiwxNTUsMjEzLDE5MSwyNTAsMTkzLDI0MiwyNDYsNTEsMTYxLDI0OCwxNjAsMjIzLDEsODQsOTksMTE2LDQwLDE0MSwyMSwxNTksMjQ2LDIxNCw2MywxOTEsMTk4LDYxLDEwNSwxOTQsMTc0LDEsMCwwXQ%3D%3D

@Princesseuh Princesseuh added feat: tsx Related to the TSX output (scope) - P2: has workaround Bug, but has workaround (priority) labels May 31, 2024
@github-actions github-actions bot added the needs triage Issue needs to be triaged label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority) feat: tsx Related to the TSX output (scope) needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants
@Princesseuh and others