From ee34656bec46843d8be97a8d7960ccacf16650a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?= Date: Sun, 19 May 2024 16:11:58 +0300 Subject: [PATCH] fs: fix openIndexFile when dirPath is empty string (#1779) --- fs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs.go b/fs.go index a3d0c6e..7738ca2 100644 --- a/fs.go +++ b/fs.go @@ -1229,7 +1229,11 @@ func ParseByteRange(byteRange []byte, contentLength int) (startPos, endPos int, func (h *fsHandler) openIndexFile(ctx *RequestCtx, dirPath string, mustCompress bool, fileEncoding string) (*fsFile, error) { for _, indexName := range h.indexNames { - indexFilePath := dirPath + "/" + indexName + indexFilePath := indexName + if dirPath != "" { + indexFilePath = dirPath + "/" + indexName + } + ff, err := h.openFSFile(indexFilePath, mustCompress, fileEncoding) if err == nil { return ff, nil