From adaa4ab929cd3cdca95010a7a77885cf373e7155 Mon Sep 17 00:00:00 2001 From: saturn4er Date: Tue, 29 Mar 2016 17:15:43 +0300 Subject: [PATCH] Fix index out of range if there is no file extension --- template.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/template.go b/template.go index f922e6ee..5cc627a5 100644 --- a/template.go +++ b/template.go @@ -167,9 +167,11 @@ func BuildTemplate(dir string, files ...string) error { for _, file := range v { if buildAllFiles || utils.InSlice(file, files) { templatesLock.Lock() - fileExt := filepath.Ext(file)[1:] + ext := filepath.Ext(file) var t TemplateRenderer - if fn, ok := beeTemplateEngines[fileExt]; ok { + if len(ext) == 0 { + t, err = getTemplate(self.root, file, v...) + } else if fn, ok := beeTemplateEngines[ext[1:]]; ok { t, err = fn(self.root, file, beegoTplFuncMap) } else { t, err = getTemplate(self.root, file, v...)