From eb019f3992e54cc5ffb821e10df78e277b2ad186 Mon Sep 17 00:00:00 2001 From: Lan Xiao Date: Wed, 26 Jun 2019 22:13:39 +0100 Subject: [PATCH] iss-1272: Fix concurrent writes when rendering html templates in ui --- pkg/ui/ui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/ui/ui.go b/pkg/ui/ui.go index 24a0bf4182..a4f6b62a8d 100644 --- a/pkg/ui/ui.go +++ b/pkg/ui/ui.go @@ -75,9 +75,9 @@ func (bu *BaseUI) executeTemplate(w http.ResponseWriter, name string, prefix str return } - bu.tmplFuncs["pathPrefix"] = func() string { return prefix } - - t, err := template.New("").Funcs(bu.tmplFuncs).Parse(text) + t, err := template.New("").Funcs(bu.tmplFuncs). + Funcs(template.FuncMap{"pathPrefix": func() string { return prefix }}). + Parse(text) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return