html/template: incorrectly escapes urls with fragments #36096
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (can reproduce it on go playground)
What did you do?
The code contains URL used by Kibana (eleastic search plugin which uses RISON for URLs)
https://play.golang.org/p/7-WnsX9FgKk
What did you expect to see?
I expected to see the original URL since the fragments should be escaped so:
https://host.com/_plugin/kibana/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:'745526c0-a366-11e9-ada4-f767130ae0b4',interval:auto,query:(language:lucene,query:'app:"app" AND proc:"web" AND environment:"staging"'),sort:!('@timestamp',desc))
URL as escaped by net.url package is also acceptable (Kibana seems to be able to handle it):
https://host.com/_plugin/kibana/app/kibana#/discover?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:%27745526c0-a366-11e9-ada4-f767130ae0b4%27,interval:auto,query:(language:lucene,query:%27app:%22app%22%20AND%20proc:%22web%22%20AND%20environment:%22staging%22%27),sort:!(%27@timestamp%27,desc))
What did you see instead?
The URL that is invalid and has wrong parts escaped:
<a href="https://host.com/_plugin/kibana/app/kibana#/discover?_g=%28refreshInterval:%28pause:!t,value:0%29,time:%28from:now-15m,mode:quick,to:now%29%29&_a=%28columns:!%28_source%29,index:%27745526c0-a366-11e9-ada4-f767130ae0b4%27,interval:auto,query:%28language:lucene,query:%27app:%22app%22%20AND%20proc:%22web%22%20AND%20environment:%22staging%22%27%29,sort:!%28%27@timestamp%27,desc%29%29">link</a>
If this is indeed a bug any workaround I can apply right now to make the template do the right thing?
The text was updated successfully, but these errors were encountered: