Description
Describe the bug
The file client/build/index.html throws an error when parsed by the golang html/template package.
To Reproduce
Steps to reproduce the behavior:
- build server using
./scripts/build.prod.sh --server
- execute the server
./build/ratel
Expected behavior
I would have expected the error not to occur
Screenshots
The exact error is
panic: Error parsing "index.html" contents
goroutine 1 [running]:
github.com/dgraph-io/ratel/server.prepareIndexContent()
/home/freddy.isaac/projects/ratel/server/server.go:112 +0x4c8
github.com/dgraph-io/ratel/server.Run()
/home/freddy.isaac/projects/ratel/server/server.go:42 +0x25
main.main()
/home/freddy.isaac/projects/ratel/main.go:11 +0xf
It is occurring on line 17 of the file index.html which is currently
function isTemplateAnnotation(str) {
return (
str.indexOf("{{") === 0 &&
str.lastIndexOf("}}") === str.length - 2
);
}
However changing this code to be
function isTemplateAnnotation(str) {
return str.indexOf("{{") === 0 && str.lastIndexOf("}}") === str.length - 2;
}
does however parse OK!
I believe that this may be an issue with the golang html/template package and have opened a ticket here to clarify
Environment
- OS: Ubuntu
- Go
- v1.24.1 but I have verified this back as far as v1.16