Test 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 will be followed by a change that updates the production role. Change-Id: Ica27cf070d50fcafd879b6f8ccc3964afa9bf5e6
This commit is contained in:
parent
e5472ffa5a
commit
9352276cc2
@ -789,7 +789,14 @@ class Uploader():
|
|||||||
headers['content-encoding'] = 'gzip'
|
headers['content-encoding'] = 'gzip'
|
||||||
data = GzipFilter(open(file_detail.full_path, 'rb'))
|
data = GzipFilter(open(file_detail.full_path, 'rb'))
|
||||||
else:
|
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
|
headers['content-encoding'] = file_detail.encoding
|
||||||
data = open(file_detail.full_path, 'rb')
|
data = open(file_detail.full_path, 'rb')
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user