Skip to content

Commit b817be9

Browse files
authored
The current version only checks for system-defined "Content-Encoding" metadata set to "gzip" on an S3 object. Some tools do not properly set this metadata on write and AWS APIs to add metadata to an S3 object can only add it as user-defined metadata. The equivalent Amazon S3 user-defined metadata attribute is "x-amz-meta-content-encoding". This update adds an additional test for whether the user-defined metadata attribute "x-amz-meta-content-encoding" is set to "gzip". (chimpler#16)
1 parent dd24621 commit b817be9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aws_s3--0.0.1.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ AS $$
9292
response = obj.get()
9393
content_encoding = response.get('ContentEncoding')
9494
body = response['Body']
95+
user_content_encoding = response.get('x-amz-meta-content-encoding')
9596

9697
with tempfile.NamedTemporaryFile() as fd:
97-
if content_encoding and content_encoding.lower() == 'gzip':
98+
if (content_encoding and content_encoding.lower() == 'gzip') or (user_content_encoding and user_content_encoding.lower() == 'gzip'):
9899
with gzip.GzipFile(fileobj=body) as gzipfile:
99100
while fd.write(gzipfile.read(204800)):
100101
pass

0 commit comments

Comments
 (0)