mirror of
https://github.com/golang/go.git
synced 2025-05-29 11:25:43 +00:00
html/template: adjust ambiguous URL context text
Before: ... appears in an ambiguous URL context. After: ... appears in an ambiguous context within a URL. It's a minor point, but it's confused multiple people. Try to make clearer that the ambiguity is "where exactly inside the URL?" Fixes #17319. Change-Id: Id834868d1275578036c1b00c2bdfcd733d9d2b7b Reviewed-on: https://go-review.googlesource.com/31465 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
13c6572341
commit
d2315fdc11
@ -44,7 +44,7 @@ const (
|
|||||||
// OK indicates the lack of an error.
|
// OK indicates the lack of an error.
|
||||||
OK ErrorCode = iota
|
OK ErrorCode = iota
|
||||||
|
|
||||||
// ErrAmbigContext: "... appears in an ambiguous URL context"
|
// ErrAmbigContext: "... appears in an ambiguous context within a URL"
|
||||||
// Example:
|
// Example:
|
||||||
// <a href="
|
// <a href="
|
||||||
// {{if .C}}
|
// {{if .C}}
|
||||||
|
@ -161,7 +161,7 @@ func (e *escaper) escapeAction(c context, n *parse.ActionNode) context {
|
|||||||
case urlPartUnknown:
|
case urlPartUnknown:
|
||||||
return context{
|
return context{
|
||||||
state: stateError,
|
state: stateError,
|
||||||
err: errorf(ErrAmbigContext, n, n.Line, "%s appears in an ambiguous URL context", n),
|
err: errorf(ErrAmbigContext, n, n.Line, "%s appears in an ambiguous context within a URL", n),
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
panic(c.urlPart.String())
|
panic(c.urlPart.String())
|
||||||
|
@ -903,7 +903,7 @@ func TestErrors(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
`<a href="{{if .F}}/foo?a={{else}}/bar/{{end}}{{.H}}">`,
|
`<a href="{{if .F}}/foo?a={{else}}/bar/{{end}}{{.H}}">`,
|
||||||
"z:1:47: {{.H}} appears in an ambiguous URL context",
|
"z:1:47: {{.H}} appears in an ambiguous context within a URL",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
`<a onclick="alert('Hello \`,
|
`<a onclick="alert('Hello \`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user