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

html/template: genereates broken result when there is JS string interpolation #55341

Closed
wxiaoguang opened this issue Sep 22, 2022 · 1 comment

Comments

@wxiaoguang
Copy link

What version of Go are you using (go version)?

Not only the latest one, I think it's an old bug.

$ go version
go version go1.19.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

N/A

What did you do?

https://go.dev/play/p/SyukPDzcZ6a

func main() {
	t := template.New("a")
	_, _ = t.Parse("<script>a=`//`</script>")
	w := &bytes.Buffer{}
	_ = t.Execute(w, nil)
	b, _ := io.ReadAll(w)
	println(string(b))
}

What did you expect to see?

Correct result:

<script>a=`//`</script>

What did you see instead?

Broken result:

<script>a=`</script>
@wxiaoguang wxiaoguang changed the title package: html/template genereates broken result when there is JS string interpolation html/template: genereates broken result when there is JS string interpolation Sep 22, 2022
@seankhliao
Copy link
Member

Duplicate of #9200

@seankhliao seankhliao marked this as a duplicate of #9200 Sep 22, 2022
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Sep 22, 2022
@golang golang locked and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants