if they are already compressed
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Ie0ce0a303f3d681b8aae697c1b358534e68b2c28
:type src_fpath: str
:type dst_fpath: str
"""
- mime = MimeTypes().guess_type(src_fpath)[0]
+ mime_guess = MimeTypes().guess_type(src_fpath)
+ mime = mime_guess[0]
+ encoding = mime_guess[1]
if not mime:
mime = "application/octet-stream"
- if mime in COMPRESS_MIME and bucket in "logs":
+ if mime in COMPRESS_MIME and bucket in "logs" and encoding != "gzip":
compress(src_fpath)
src_fpath = src_fpath + ".gz"
dst_fpath = dst_fpath + ".gz"