all repos — elgit @ 975625f9d4d26eb56f4428f2921b9e1090a49621

fork of legit: web frontend for git, written in go

switch to atreugo

Alan Pearce
commit

975625f9d4d26eb56f4428f2921b9e1090a49621

parent

8b1540f0bd4d2e042b28506abcb3de9189399b1b

1 file changed, 5 insertions(+), 9 deletions(-)

changed files
M routes/util.goroutes/util.go
@@ -3,7 +3,6 @@
import ( "bufio" "log" - "net/http" "os" "path/filepath" "slices"
@@ -13,6 +12,7 @@ "alin.ovh/elgit/data"
"alin.ovh/elgit/git" securejoin "github.com/cyphar/filepath-securejoin" "github.com/dimfeld/httptreemux/v5" + "github.com/savsgio/atreugo/v11" ) func isGoModule(gr *git.Repo) bool {
@@ -114,15 +114,11 @@
return entries } -func setContentDisposition(w http.ResponseWriter, name string) { +func setContentDisposition(rc *atreugo.RequestCtx, name string) { h := "inline; filename=\"" + name + "\"" - w.Header().Add("Content-Disposition", h) -} - -func setGZipMIME(w http.ResponseWriter) { - setMIME(w, "application/gzip") + rc.Response.Header.Set("Content-Disposition", h) } -func setMIME(w http.ResponseWriter, mime string) { - w.Header().Add("Content-Type", mime) +func setGZipMIME(rc *atreugo.RequestCtx) { + rc.SetContentType("application/gzip") }