From e39f3eba4485b6a4bc9111d6a403853db374195f Mon Sep 17 00:00:00 2001 From: Travis McLane Date: Fri, 4 Feb 2022 14:19:02 -0600 Subject: [PATCH] use path to first index.html file for 'index' (#1127) --- v2/internal/fs/fs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/v2/internal/fs/fs.go b/v2/internal/fs/fs.go index 0f6fbb7ea..a67455de8 100644 --- a/v2/internal/fs/fs.go +++ b/v2/internal/fs/fs.go @@ -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])