diff --git a/swift3/controllers/multi_upload.py b/swift3/controllers/multi_upload.py index 4776d851..be30c86c 100644 --- a/swift3/controllers/multi_upload.py +++ b/swift3/controllers/multi_upload.py @@ -612,7 +612,10 @@ class UploadController(Controller): # clean up the multipart-upload record obj = '%s/%s' % (req.object_name, upload_id) - req.get_response(self.app, 'DELETE', container, obj) + try: + req.get_response(self.app, 'DELETE', container, obj) + except NoSuchKey: + pass # We know that this existed long enough for us to HEAD result_elem = Element('CompleteMultipartUploadResult') diff --git a/swift3/test/unit/test_multi_upload.py b/swift3/test/unit/test_multi_upload.py index 19bedb8a..9b1312f5 100644 --- a/swift3/test/unit/test_multi_upload.py +++ b/swift3/test/unit/test_multi_upload.py @@ -621,6 +621,23 @@ class TestSwift3MultiUpload(Swift3TestCase): self.assertEqual(headers.get('X-Object-Meta-Foo'), 'bar') self.assertEqual(headers.get('Content-Type'), 'baz/quux') + def test_object_multipart_upload_complete_404_on_marker_delete(self): + segment_bucket = '/v1/AUTH_test/bucket+segments' + self.swift.register('DELETE', segment_bucket + '/object/X', + swob.HTTPNotFound, {}, None) + req = Request.blank('/bucket/object?uploadId=X', + environ={'REQUEST_METHOD': 'POST'}, + headers={'Authorization': 'AWS test:tester:hmac', + 'Date': self.get_date_header(), }, + body=xml) + status, headers, body = self.call_swift3(req) + self.assertEqual(status.split()[0], '200') + fromstring(body, 'CompleteMultipartUploadResult') + + _, _, headers = self.swift.calls_with_headers[-2] + self.assertEqual(headers.get('X-Object-Meta-Foo'), 'bar') + self.assertEqual(headers.get('Content-Type'), 'baz/quux') + def test_object_multipart_upload_complete_weird_host_name(self): # This happens via boto signature v4 req = Request.blank('/bucket/object?uploadId=X',