]> Cypherpunks repositories - gostls13.git/commit
html/template: only search identifier nodes for predefined escapers
authorSamuel Tan <samueltan@google.com>
Thu, 11 May 2017 23:56:14 +0000 (16:56 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 14 Jun 2017 16:52:22 +0000 (16:52 +0000)
commit882a640421c5ac480d40ae02736c95046fec11aa
treebd6aa3d6278d2d9a3b2aae5bef92e7993361cf07
parent2c3c8c4247f84f53533dc61f606bbde09f783cdf
html/template: only search identifier nodes for predefined escapers

Predefined escapers (i.e. "html" and "urlquery") should only occur in
Identifier nodes, and never in Field or Chain nodes, since these are
global functions that return string values (see inline comments for more
details). Therefore, skip Chain and Field nodes when searching for
predefined escapers in template pipelines.

Also, make a non-functional change two existing test cases to avoid
giving the impression that it is valid to reference a field of a
predefined escaper.

Fixes #20323

Change-Id: I34f722f443c778699fcdd575dc3e0fd1fd6f2eb3
Reviewed-on: https://go-review.googlesource.com/43296
Reviewed-by: Samuel Tan <samueltan@google.com>
Reviewed-by: Mike Samuel <mikesamuel@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/html/template/escape.go
src/html/template/escape_test.go