1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00

minor (see prev commit)

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-09-26 00:34:18 +03:00
parent 512ed6ffc0
commit 68daa8d51d
10 changed files with 133 additions and 69 deletions

View File

@@ -134,6 +134,8 @@ func (s *HandlebarsEngine) AddGlobalFunc(funcName string, funcBody interface{})
//
// Returns an error if something bad happens, user is responsible to catch it.
func (s *HandlebarsEngine) Load() error {
rootDirName := getRootDirName(s.fs)
return walk(s.fs, "", func(path string, info os.FileInfo, _ error) error {
if info == nil || info.IsDir() {
return nil
@@ -145,6 +147,11 @@ func (s *HandlebarsEngine) Load() error {
}
}
if s.rootDir == rootDirName {
path = strings.TrimPrefix(path, rootDirName)
path = strings.TrimPrefix(path, "/")
}
contents, err := asset(s.fs, path)
if err != nil {
return err