~netlandish/gobwebs

d07fccceaa7e928015ef18ca9d8595ae84a7b61c — Peter Sanchez 2 years ago fe25782
Adding additional template context key collision checking
1 files changed, 4 insertions(+), 1 deletions(-)

M validate/template.go
M validate/template.go => validate/template.go +4 -1
@@ 57,12 57,15 @@ func (t *Template) tmplPayload(c echo.Context, data Map) (Map, error) {
	}
	// Now static variables
	for k, v := range t.staticMap {
		if _, ok := input[k]; ok {
			return nil, fmt.Errorf("Template context conflict (static data). Reserved key: %v", k)
		}
		input[k] = v
	}
	if data != nil {
		for k, v := range data {
			if _, ok := input[k]; ok {
				return nil, fmt.Errorf("Template context conflict. Reserved key: %v", k)
				return nil, fmt.Errorf("Template context conflict (handler data). Reserved key: %v", k)
			}
			input[k] = v
		}