From 981e192d2ed0cc3772f8ba8107a4cfc8dc33d214 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 23 Jun 2024 17:23:45 +0200 Subject: fix: Ignore tar files when compressing --- pkg/ext/compression.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/ext/compression.go') diff --git a/pkg/ext/compression.go b/pkg/ext/compression.go index 57ad49a..9e933ef 100644 --- a/pkg/ext/compression.go +++ b/pkg/ext/compression.go @@ -26,6 +26,13 @@ type CompressionResponseWriter struct { func Compress(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + + // TODO: hand this better + if strings.HasSuffix(r.URL.Path, ".tar.gz") { + next(w, r) + return + } + if accept, ok := r.Header["Accept-Encoding"]; ok { if compress, algo := GetCompressionWriter(u.FirstOrZero(accept), w); algo != "" { defer compress.Close() -- cgit v1.2.3