use path to first index.html file for 'index' (#1127)

This commit is contained in:
Travis McLane
2022-02-05 07:19:02 +11:00
committed by GitHub
parent de7f08357c
commit e39f3eba44
+8 -1
View File
@@ -417,7 +417,14 @@ func FindPathToFile(fsys fs.FS, file string) (string, error) {
}
if indexFiles.Length() > 1 {
return "", fmt.Errorf("multiple '%s' files found in assets", file)
selected := indexFiles.AsSlice()[0]
for _, f := range indexFiles.AsSlice() {
if len(f) < len(selected) {
selected = f
}
}
path, _ := filepath.Split(selected)
return path, nil
}
path, _ := filepath.Split(indexFiles.AsSlice()[0])