From 35865d5f792a6c0a4285061550089b865a9d6bb7 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 15 Aug 2023 11:38:30 +0200 Subject: [PATCH] chore: apply feedback suggestion Co-authored-by: Marcin Rataj --- gateway/handler_unixfs_dir.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gateway/handler_unixfs_dir.go b/gateway/handler_unixfs_dir.go index fdcd8aaac..1ece9c96d 100644 --- a/gateway/handler_unixfs_dir.go +++ b/gateway/handler_unixfs_dir.go @@ -62,10 +62,10 @@ func (i *handler) serveDirectory(ctx context.Context, w http.ResponseWriter, r * // Check if directory has index.html, if so, serveFile appendIndexHtml := func(p ipath.Path) ipath.Path { basePath := p.String() - if basePath[len(basePath)-1] == '/' { - return ipath.New(basePath + "index.html") + if basePath[len(basePath)-1] != '/' { + basePath += "/" } - return ipath.New(basePath + "/index.html") + return ipath.New(basePath + "index.html") } idxPath := appendIndexHtml(contentPath)