Merge pull request 'Fix github-style non-.html URLs repeating the path twice' (#23) from bugfix/github-style-nohtml-paths into main

Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/23
This commit is contained in:
Moritz Marquardt 2021-12-05 13:56:01 +01:00
commit 2e970dbcda
1 changed files with 1 additions and 1 deletions

View File

@ -446,7 +446,7 @@ func upstream(ctx *fasthttp.RequestCtx, targetOwner string, targetRepo string, t
}
// compatibility fix for GitHub Pages (/example → /example.html)
optionsForIndexPages.AppendTrailingSlash = false
optionsForIndexPages.RedirectIfExists = targetPath + ".html"
optionsForIndexPages.RedirectIfExists = string(ctx.Request.URI().Path()) + ".html"
if upstream(ctx, targetOwner, targetRepo, targetBranch, targetPath + ".html", &optionsForIndexPages) {
_ = fileResponseCache.Set(uri+"?timestamp="+strconv.FormatInt(options.BranchTimestamp.Unix(), 10), fileResponse{
exists: false,