🐛 Fix serve static dir issue
This commit is contained in:
parent
a11af366ef
commit
b006d29f53
@ -148,10 +148,10 @@ func makeFileResponse(c *fiber.Ctx, dest *Destination) error {
|
|||||||
return fmt.Errorf("failed to stat: %w", err)
|
return fmt.Errorf("failed to stat: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve index if path is directory
|
// Serve index if the path is a directory
|
||||||
if stat.IsDir() {
|
if stat.IsDir() {
|
||||||
indexFile := lo.Ternary(len(queries.Get("index")) > 0, queries.Get("index"), "index.html")
|
indexFile := lo.Ternary(len(queries.Get("index")) > 0, queries.Get("index"), "index.html")
|
||||||
indexPath := utils.TrimRight(path, '/') + indexFile
|
indexPath := filepath.Join(path, indexFile)
|
||||||
index, err := root.Open(indexPath)
|
index, err := root.Open(indexPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
indexStat, err := index.Stat()
|
indexStat, err := index.Stat()
|
||||||
|
Loading…
Reference in New Issue
Block a user