From: Andrew Yourtchenko Date: Fri, 29 Jan 2021 11:31:43 +0000 (+0000) Subject: backup upload archives: avoid gzip compressing the files X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=30ac6e735733993c6a15e173438eb79811cc3b49;p=ci-management.git backup upload archives: avoid gzip compressing the files if they are already compressed Signed-off-by: Andrew Yourtchenko Change-Id: Ie0ce0a303f3d681b8aae697c1b358534e68b2c28 --- diff --git a/jjb/scripts/backup_upload_archives.sh b/jjb/scripts/backup_upload_archives.sh index a7eb16631..1a9c577e1 100755 --- a/jjb/scripts/backup_upload_archives.sh +++ b/jjb/scripts/backup_upload_archives.sh @@ -77,11 +77,13 @@ def upload(storage, bucket, src_fpath, dst_fpath): :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"