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

This commit is contained in:
Travis McLane 2022-02-04 14:19:02 -06:00 committed by GitHub
commit e39f3eba44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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])