URI: 
       tpl: check that types in args match the target func's type - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit be15927819fab6a78d9faea904ee8037ce577984
   DIR parent be049ff96ad5c5af1192316b43a2e9577ef0b065
  HTML Author: bep <bjorn.erik.pedersen@gmail.com>
       Date:   Fri,  1 May 2015 17:00:22 +0200
       
       tpl: check that types in args match the target func's type
       
       Fixes #1095
       
       Diffstat:
         M tpl/template_funcs.go               |       6 ++++++
         M tpl/template_test.go                |       5 ++++-
       
       2 files changed, 10 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go
       @@ -672,6 +672,12 @@ func applyFnToThis(fn, this reflect.Value, args ...interface{}) (reflect.Value, 
                        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)
        
                if len(res) == 1 || res[1].IsNil() {
   DIR diff --git a/tpl/template_test.go b/tpl/template_test.go
       @@ -23,7 +23,10 @@ func TestTplGoFuzzReports(t *testing.T) {
                        {"{{ slicestr \"000000\" 10}}", 2},
                        // Issue #1091
                        {"{{apply .C \"first\" 0 0 0}}", 2},
       -                {"{{seq 3e80}}", 2}} {
       +                {"{{seq 3e80}}", 2},
       +                // Issue #1095
       +                {"{{apply .C \"urlize\" " +
       +                        "\".\"}}", 2}} {
                        templ := New()
        
                        d := &Data{