From 4beaaa06505220c80d502d7b3ebd8b8b71071f5f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 9 Jan 2017 19:31:55 -0800 Subject: [PATCH] simplify the gzip optimization logic fix https://github.com/chrislusf/seaweedfs/issues/436 --- weed/storage/needle.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/weed/storage/needle.go b/weed/storage/needle.go index 82ba2fb6a..29e70ff10 100644 --- a/weed/storage/needle.go +++ b/weed/storage/needle.go @@ -144,11 +144,13 @@ func ParseUpload(r *http.Request) ( isGzipped = true } if ext == ".gz" { - isGzipped = true - } - if strings.HasSuffix(fileName, ".gz") && - !strings.HasSuffix(fileName, ".tar.gz") { - fileName = fileName[:len(fileName)-3] + if strings.HasSuffix(fileName, ".css.gz") || + strings.HasSuffix(fileName, ".html.gz") || + strings.HasSuffix(fileName, ".txt.gz") || + strings.HasSuffix(fileName, ".js.gz") { + fileName = fileName[:len(fileName)-3] + isGzipped = true + } } } modifiedTime, _ = strconv.ParseUint(r.FormValue("ts"), 10, 64)