weed volume: only store compressed data if compression is effective

This commit is contained in:
Chris Lu 2019-04-06 00:10:52 -07:00
parent b2d92a2992
commit 94302935b2

View file

@ -88,12 +88,14 @@ func parseMultipart(r *http.Request) (
}
isGzipped = true
} else if operation.IsGzippable(ext, mtype, data) {
if data, e = operation.GzipData(data); e != nil {
return
}
if compressedData, err := operation.GzipData(data); err == nil {
if len(data) > len(compressedData) {
data = compressedData
isGzipped = true
}
}
}
}
return
}