Hotfix for #27: avoid slash before .html in GitHub compatibility redirects

pull/58/head v2.4
Moritz Marquardt 2021-12-05 22:12:48 +01:00
rodzic 2e970dbcda
commit 67a190f68a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: D5788327BEE388B6
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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 = 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) {
_ = fileResponseCache.Set(uri+"?timestamp="+strconv.FormatInt(options.BranchTimestamp.Unix(), 10), fileResponse{
exists: false,