diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-10-07 13:24:16 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-10-07 13:24:16 -0700 |
| commit | 332f5ad3a82343c1a63e96a05cda09c7a71b581f (patch) | |
| tree | 518d0eaf4c6dd4e69d4e749133271a916f6fdf5a | |
| parent | f3d8232e1424e2e1ff9b2de695a05b58ef3f92b7 (diff) | |
| download | seaweedfs-332f5ad3a82343c1a63e96a05cda09c7a71b581f.tar.xz seaweedfs-332f5ad3a82343c1a63e96a05cda09c7a71b581f.zip | |
revert temporary changes that disabled compression
fix https://github.com/chrislusf/seaweedfs/issues/2362
| -rw-r--r-- | weed/storage/needle/needle_parse_upload.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/weed/storage/needle/needle_parse_upload.go b/weed/storage/needle/needle_parse_upload.go index 0888c6b7a..fe6b7d740 100644 --- a/weed/storage/needle/needle_parse_upload.go +++ b/weed/storage/needle/needle_parse_upload.go @@ -75,16 +75,14 @@ func ParseUpload(r *http.Request, sizeLimit int64, bytesBuffer *bytes.Buffer) (p if mimeType == "application/octet-stream" { mimeType = "" } - if false { - if shouldBeCompressed, iAmSure := util.IsCompressableFileType(ext, mimeType); mimeType == "" && !iAmSure || shouldBeCompressed && iAmSure { - // println("ext", ext, "iAmSure", iAmSure, "shouldBeCompressed", shouldBeCompressed, "mimeType", pu.MimeType) - if compressedData, err := util.GzipData(pu.Data); err == nil { - if len(compressedData)*10 < len(pu.Data)*9 { - pu.Data = compressedData - pu.IsGzipped = true - } - // println("gzipped data size", len(compressedData)) + if shouldBeCompressed, iAmSure := util.IsCompressableFileType(ext, mimeType); mimeType == "" && !iAmSure || shouldBeCompressed && iAmSure { + // println("ext", ext, "iAmSure", iAmSure, "shouldBeCompressed", shouldBeCompressed, "mimeType", pu.MimeType) + if compressedData, err := util.GzipData(pu.Data); err == nil { + if len(compressedData)*10 < len(pu.Data)*9 { + pu.Data = compressedData + pu.IsGzipped = true } + // println("gzipped data size", len(compressedData)) } } } |
