Addons: Only template `.tmpl` files

pull/18687/head
Steven Powell 2024-05-01 09:32:35 -07:00 committed by Medya Ghazizadeh
parent 3f852c8c73
commit b46d912116
1 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import (
"path"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/pkg/errors"
@ -358,12 +359,14 @@ func (m *BinAsset) loadData() error {
return err
}
tpl, err := template.New(m.SourcePath).Funcs(template.FuncMap{"default": defaultValue}).Parse(string(contents))
if err != nil {
return err
}
if strings.HasSuffix(m.BaseAsset.SourcePath, ".tmpl") {
tpl, err := template.New(m.SourcePath).Funcs(template.FuncMap{"default": defaultValue}).Parse(string(contents))
if err != nil {
return err
}
m.template = tpl
m.template = tpl
}
m.length = len(contents)
m.reader = bytes.NewReader(contents)