1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-05 07:56:00 +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

@@ -109,7 +109,6 @@ func (s *HTMLEngine) RootDir(root string) *HTMLEngine {
if err != nil {
panic(err)
}
s.fs = sub // here so the "middleware" can work.
}
@@ -255,6 +254,8 @@ func (s *HTMLEngine) load() error {
return err
}
rootDirName := getRootDirName(s.fs)
err := walk(s.fs, "", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
@@ -270,6 +271,11 @@ func (s *HTMLEngine) load() error {
}
}
if s.rootDir == rootDirName {
path = strings.TrimPrefix(path, rootDirName)
path = strings.TrimPrefix(path, "/")
}
buf, err := asset(s.fs, path)
if err != nil {
return fmt.Errorf("%s: %w", path, err)