Add support for serving index.html for sub-dirs

This commit is contained in:
James Mills 2023-08-20 01:20:26 +10:00
parent 4e4baa154c
commit 541367fcc4
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -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) {