1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 17:00:54 +00:00

Fix index out of range if there is no file extension

This commit is contained in:
saturn4er 2016-03-29 17:15:43 +03:00
parent 66423f6935
commit adaa4ab929

View File

@ -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...)