mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-26 05:55:27 +00:00
Hotfix for #27: avoid slash before .html in GitHub compatibility redirects
This commit is contained in:
parent
2e970dbcda
commit
67a190f68a
@ -446,7 +446,7 @@ func upstream(ctx *fasthttp.RequestCtx, targetOwner string, targetRepo string, t
|
|||||||
}
|
}
|
||||||
// compatibility fix for GitHub Pages (/example → /example.html)
|
// compatibility fix for GitHub Pages (/example → /example.html)
|
||||||
optionsForIndexPages.AppendTrailingSlash = false
|
optionsForIndexPages.AppendTrailingSlash = false
|
||||||
optionsForIndexPages.RedirectIfExists = string(ctx.Request.URI().Path()) + ".html"
|
optionsForIndexPages.RedirectIfExists = strings.TrimSuffix(string(ctx.Request.URI().Path()), "/") + ".html"
|
||||||
if upstream(ctx, targetOwner, targetRepo, targetBranch, targetPath + ".html", &optionsForIndexPages) {
|
if upstream(ctx, targetOwner, targetRepo, targetBranch, targetPath + ".html", &optionsForIndexPages) {
|
||||||
_ = fileResponseCache.Set(uri+"?timestamp="+strconv.FormatInt(options.BranchTimestamp.Unix(), 10), fileResponse{
|
_ = fileResponseCache.Set(uri+"?timestamp="+strconv.FormatInt(options.BranchTimestamp.Unix(), 10), fileResponse{
|
||||||
exists: false,
|
exists: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user