From c7c3e1437bd92982937ba6ce6b46a002077912c0 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 17 Jul 2025 23:51:22 +0100 Subject: Force trailing slash if directory --- pkg/site/fs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/site/fs.go b/pkg/site/fs.go index 6a3b1d6..11b36cf 100644 --- a/pkg/site/fs.go +++ b/pkg/site/fs.go @@ -50,6 +50,10 @@ func (fs *SiteFileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if info.IsDir() { + if !strings.HasSuffix(path, "/") { + http.Redirect(w, r, path+"/", http.StatusTemporaryRedirect) + return + } indexPath := filepath.Join(path, "index.html") if file, err = fs.root.Open(indexPath); os.IsNotExist(err) { if fs.siteConfig.Flags&config.FlagIndex == 0 { -- cgit v1.2.3-70-g09d2