From 541367fcc450656f784a7d0df639bd794e267f3a Mon Sep 17 00:00:00 2001 From: James Mills <1290234+prologic@users.noreply.github.com> Date: Sun, 20 Aug 2023 01:20:26 +1000 Subject: [PATCH] Add support for serving index.html for sub-dirs --- gitea/gitea.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gitea/gitea.go b/gitea/gitea.go index 23f4540..d95a1cc 100644 --- a/gitea/gitea.go +++ b/gitea/gitea.go @@ -68,6 +68,11 @@ func (c *Client) Open(user, path string) (fs.File, error) { filepath = "index.html" } + // If it's a dir, give them index.html + if strings.HasSuffix(filepath, "/") { + *filepath += "index.html" + } + allowed := c.allowsPages(user, repo) log.Printf("allowed? %t", allowed) if !allowed && repo != fmt.Sprintf("%s.%s", user, c.domain) {