Swift upload logs without encoding type for gzip files
When retrieving gzipped files out of swift with gzip encoding set some swift implementations return a decompressed version of the file if your client cannot accept gzip encoding. This causes problems when the file you want is actually compressed like a .tar.gz. Instead we avoid setting the encoding type of these files forcing swift to give them back as is. This change should only be approved after confirming its parent is tested and working. Change-Id: Ibcf478b572ba84273732e0ede17bf92bddd8c36f
This commit is contained in:
parent
9352276cc2
commit
0e23325a12
@ -746,7 +746,14 @@ class Uploader():
|
||||
headers['content-encoding'] = 'gzip'
|
||||
data = GzipFilter(open(file_detail.full_path, 'rb'))
|
||||
else:
|
||||
if file_detail.encoding:
|
||||
if (not file_detail.filename.endswith(".gz") and
|
||||
file_detail.encoding):
|
||||
# Don't apply gzip encoding to files that we receive as
|
||||
# already gzipped. The reason for this is swift will
|
||||
# serve this back to users as an uncompressed file if they
|
||||
# don't set an accept-encoding that includes gzip. This
|
||||
# can cause problems when the desired file state is
|
||||
# compressed as with .tar.gz tarballs.
|
||||
headers['content-encoding'] = file_detail.encoding
|
||||
data = open(file_detail.full_path, 'rb')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user