mirror of
https://github.com/gohugoio/hugo.git
synced 2024-07-08 01:56:15 +00:00
parent
be049ff96a
commit
be15927819
|
@ -672,6 +672,12 @@ func applyFnToThis(fn, this reflect.Value, args ...interface{}) (reflect.Value,
|
||||||
return reflect.ValueOf(nil), errors.New("Too many arguments")
|
return reflect.ValueOf(nil), errors.New("Too many arguments")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 0; i < num; i++ {
|
||||||
|
if xt, targ := n[i].Type(), fn.Type().In(i); !xt.AssignableTo(targ) {
|
||||||
|
return reflect.ValueOf(nil), errors.New("called apply using " + xt.String() + " as type " + targ.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res := fn.Call(n)
|
res := fn.Call(n)
|
||||||
|
|
||||||
if len(res) == 1 || res[1].IsNil() {
|
if len(res) == 1 || res[1].IsNil() {
|
||||||
|
|
|
@ -23,7 +23,10 @@ func TestTplGoFuzzReports(t *testing.T) {
|
||||||
{"{{ slicestr \"000000\" 10}}", 2},
|
{"{{ slicestr \"000000\" 10}}", 2},
|
||||||
// Issue #1091
|
// Issue #1091
|
||||||
{"{{apply .C \"first\" 0 0 0}}", 2},
|
{"{{apply .C \"first\" 0 0 0}}", 2},
|
||||||
{"{{seq 3e80}}", 2}} {
|
{"{{seq 3e80}}", 2},
|
||||||
|
// Issue #1095
|
||||||
|
{"{{apply .C \"urlize\" " +
|
||||||
|
"\".\"}}", 2}} {
|
||||||
templ := New()
|
templ := New()
|
||||||
|
|
||||||
d := &Data{
|
d := &Data{
|
||||||
|
|
Loading…
Reference in a new issue