diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:23:45 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-06-23 17:23:45 +0200 |
commit | 981e192d2ed0cc3772f8ba8107a4cfc8dc33d214 (patch) | |
tree | fc3d7f2b7db5f64cc73626117f90925d3c4d23da | |
parent | 72495f4538215051540eb05c14db0ed16142e06e (diff) | |
download | cerrado-981e192d2ed0cc3772f8ba8107a4cfc8dc33d214.tar.gz cerrado-981e192d2ed0cc3772f8ba8107a4cfc8dc33d214.tar.bz2 cerrado-981e192d2ed0cc3772f8ba8107a4cfc8dc33d214.zip |
fix: Ignore tar files when compressing
-rw-r--r-- | pkg/ext/compression.go | 7 |
1 files changed, 7 insertions, 0 deletions
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() |