diff --git a/cmd/rio/main.go b/cmd/rio/main.go index 69858ab..12279b6 100644 --- a/cmd/rio/main.go +++ b/cmd/rio/main.go @@ -38,6 +38,14 @@ func handleSubdomain(domain, cname, path, giteaUrl, defaultCsp string, giteaClie path = path[1:] } + // Provide a default file. + switch { + case path == "": + path = "/index.html" + case path[len(path)-1] == '/': + path = path + "index.html" + } + repo, path, err := repo.RepoFromPath( username, domain, diff --git a/internal/pages/pages.go b/internal/pages/pages.go index 685a84a..f203a48 100644 --- a/internal/pages/pages.go +++ b/internal/pages/pages.go @@ -38,14 +38,6 @@ func addHeaders(csp, contentType string, w http.ResponseWriter) { } func ServeFile(username, reponame, path, defaultCsp string, giteaClient *repo.GiteaClient, w http.ResponseWriter) { - // Provide a default file. - switch { - case path == "": - path = "/index.html" - case path[len(path)-1] == '/': - path = path + "index.html" - } - // Strip away a starting / as it messes with Gitea if path[:1] == "/" { path = path[1:]