Set Content-Type with s3api metadata updates.
S3 supports two metadata operations on object copy: COPY and REPLACE. When using REPLACE, the Content-Type should be set to the one supplied by the caller. When using COPY, the existing object's Content-Type value is used. Change-Id: Ic7c6278dedef308c9219eb45751abfa5655f144f Closes-Bug: #1828907
This commit is contained in:
parent
032cf3b3b4
commit
8b64381371
@ -42,7 +42,6 @@ ceph_s3:
|
|||||||
s3tests.functional.test_s3.test_object_acl_xml_writeacp: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_acl_xml_writeacp: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_copy_canned_acl: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_copy_canned_acl: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_copy_not_owned_object_bucket: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_copy_not_owned_object_bucket: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_copy_replacing_metadata: {status: KNOWN}
|
|
||||||
s3tests.functional.test_s3.test_object_giveaway: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_giveaway: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_header_acl_grants: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_header_acl_grants: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_raw_get: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_raw_get: {status: KNOWN}
|
||||||
|
@ -23,7 +23,6 @@ ceph_s3:
|
|||||||
s3tests.functional.test_s3.test_logging_toggle: {status: KNOWN}
|
s3tests.functional.test_s3.test_logging_toggle: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_multipart_resend_first_finishes_last: {status: KNOWN}
|
s3tests.functional.test_s3.test_multipart_resend_first_finishes_last: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_copy_canned_acl: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_copy_canned_acl: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_copy_replacing_metadata: {status: KNOWN}
|
|
||||||
s3tests.functional.test_s3.test_object_header_acl_grants: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_header_acl_grants: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_raw_get: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_raw_get: {status: KNOWN}
|
||||||
s3tests.functional.test_s3.test_object_raw_get_bucket_acl: {status: KNOWN}
|
s3tests.functional.test_s3.test_object_raw_get_bucket_acl: {status: KNOWN}
|
||||||
|
@ -1111,14 +1111,13 @@ class S3Request(swob.Request):
|
|||||||
env['HTTP_X_COPY_FROM'] = env['HTTP_X_AMZ_COPY_SOURCE']
|
env['HTTP_X_COPY_FROM'] = env['HTTP_X_AMZ_COPY_SOURCE']
|
||||||
del env['HTTP_X_AMZ_COPY_SOURCE']
|
del env['HTTP_X_AMZ_COPY_SOURCE']
|
||||||
env['CONTENT_LENGTH'] = '0'
|
env['CONTENT_LENGTH'] = '0'
|
||||||
# Content type cannot be modified on COPY
|
|
||||||
env.pop('CONTENT_TYPE', None)
|
|
||||||
if env.pop('HTTP_X_AMZ_METADATA_DIRECTIVE', None) == 'REPLACE':
|
if env.pop('HTTP_X_AMZ_METADATA_DIRECTIVE', None) == 'REPLACE':
|
||||||
env['HTTP_X_FRESH_METADATA'] = 'True'
|
env['HTTP_X_FRESH_METADATA'] = 'True'
|
||||||
else:
|
else:
|
||||||
copy_exclude_headers = ('HTTP_CONTENT_DISPOSITION',
|
copy_exclude_headers = ('HTTP_CONTENT_DISPOSITION',
|
||||||
'HTTP_CONTENT_ENCODING',
|
'HTTP_CONTENT_ENCODING',
|
||||||
'HTTP_CONTENT_LANGUAGE',
|
'HTTP_CONTENT_LANGUAGE',
|
||||||
|
'CONTENT_TYPE',
|
||||||
'HTTP_EXPIRES',
|
'HTTP_EXPIRES',
|
||||||
'HTTP_CACHE_CONTROL',
|
'HTTP_CACHE_CONTROL',
|
||||||
'HTTP_X_ROBOTS_TAG')
|
'HTTP_X_ROBOTS_TAG')
|
||||||
|
@ -697,8 +697,7 @@ class TestS3ApiObj(S3ApiTestCase):
|
|||||||
self.assertEqual(headers['Content-Disposition'], 'how are you')
|
self.assertEqual(headers['Content-Disposition'], 'how are you')
|
||||||
self.assertEqual(headers['Content-Encoding'], 'good and you')
|
self.assertEqual(headers['Content-Encoding'], 'good and you')
|
||||||
self.assertEqual(headers['Content-Language'], 'great')
|
self.assertEqual(headers['Content-Language'], 'great')
|
||||||
# Content-Type can't be set during an S3 copy operation
|
self.assertEqual(headers['Content-Type'], 'so')
|
||||||
self.assertIsNone(headers.get('Content-Type'))
|
|
||||||
self.assertEqual(headers['Expires'], 'yeah')
|
self.assertEqual(headers['Expires'], 'yeah')
|
||||||
self.assertEqual(headers['X-Robots-Tag'], 'bye')
|
self.assertEqual(headers['X-Robots-Tag'], 'bye')
|
||||||
|
|
||||||
@ -1187,5 +1186,6 @@ class TestS3ApiObjNonUTC(TestS3ApiObj):
|
|||||||
os.environ['TZ'] = self.orig_tz
|
os.environ['TZ'] = self.orig_tz
|
||||||
time.tzset()
|
time.tzset()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user