feat: Move the path modifications around
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
40ce4e81a8
commit
de14a0e68d
@ -38,6 +38,14 @@ func handleSubdomain(domain, cname, path, giteaUrl, defaultCsp string, giteaClie
|
|||||||
path = path[1:]
|
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(
|
repo, path, err := repo.RepoFromPath(
|
||||||
username,
|
username,
|
||||||
domain,
|
domain,
|
||||||
|
@ -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) {
|
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
|
// Strip away a starting / as it messes with Gitea
|
||||||
if path[:1] == "/" {
|
if path[:1] == "/" {
|
||||||
path = path[1:]
|
path = path[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user