Fix response of Upload Part Copy requests
Fix root tag of response body for Upload Part Copy requests. Correct body is following. <?xml version="1.0" encoding="UTF-8"?> <CopyPartResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <LastModified>2015-01-16T07:42:41.000Z</LastModified> <ETag>"dd0591c4f082a4b1b57ea779a1566a28"</ETag> </CopyPartResult> Change-Id: I69801c50670c576485a9f0f5c12e578c1c433374
This commit is contained in:
parent
a0834c83a4
commit
1a0253638f
5
doc/rnc/copy_part_result.rnc
Normal file
5
doc/rnc/copy_part_result.rnc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
start =
|
||||||
|
element CopyPartResult {
|
||||||
|
element LastModified { xsd:dateTime },
|
||||||
|
element ETag { xsd:string }
|
||||||
|
}
|
@ -114,7 +114,7 @@ class PartController(Controller):
|
|||||||
resp = req.get_response(self.app)
|
resp = req.get_response(self.app)
|
||||||
|
|
||||||
if 'X-Amz-Copy-Source' in req.headers:
|
if 'X-Amz-Copy-Source' in req.headers:
|
||||||
resp.append_copy_resp_body()
|
resp.append_copy_resp_body(req.controller_name)
|
||||||
|
|
||||||
resp.status = 200
|
resp.status = 200
|
||||||
return resp
|
return resp
|
||||||
|
@ -96,7 +96,7 @@ class ObjectController(Controller):
|
|||||||
resp = req.get_response(self.app)
|
resp = req.get_response(self.app)
|
||||||
|
|
||||||
if 'X-Amz-Copy-Source' in req.headers:
|
if 'X-Amz-Copy-Source' in req.headers:
|
||||||
resp.append_copy_resp_body()
|
resp.append_copy_resp_body(req.controller_name)
|
||||||
|
|
||||||
resp.status = HTTP_OK
|
resp.status = HTTP_OK
|
||||||
return resp
|
return resp
|
||||||
|
@ -135,8 +135,8 @@ class Response(ResponseBase, swob.Response):
|
|||||||
|
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def append_copy_resp_body(self):
|
def append_copy_resp_body(self, controller_name):
|
||||||
elem = Element('CopyObjectResult')
|
elem = Element('Copy%sResult' % controller_name)
|
||||||
SubElement(elem, 'LastModified').text = \
|
SubElement(elem, 'LastModified').text = \
|
||||||
self.last_modified.isoformat()[:-6] + '.000Z'
|
self.last_modified.isoformat()[:-6] + '.000Z'
|
||||||
SubElement(elem, 'ETag').text = '"%s"' % self.etag
|
SubElement(elem, 'ETag').text = '"%s"' % self.etag
|
||||||
|
13
swift3/schema/copy_part_result.rng
Normal file
13
swift3/schema/copy_part_result.rng
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||||
|
<start>
|
||||||
|
<element name="CopyPartResult">
|
||||||
|
<element name="LastModified">
|
||||||
|
<data type="dateTime"/>
|
||||||
|
</element>
|
||||||
|
<element name="ETag">
|
||||||
|
<data type="string"/>
|
||||||
|
</element>
|
||||||
|
</element>
|
||||||
|
</start>
|
||||||
|
</grammar>
|
@ -751,7 +751,7 @@ class TestSwift3MultiUpload(Swift3TestCase):
|
|||||||
self.assertEquals(status.split()[0], '200')
|
self.assertEquals(status.split()[0], '200')
|
||||||
self.assertEquals(headers['Content-Type'], 'application/xml')
|
self.assertEquals(headers['Content-Type'], 'application/xml')
|
||||||
self.assertTrue(headers.get('etag') is None)
|
self.assertTrue(headers.get('etag') is None)
|
||||||
elem = fromstring(body, 'CopyObjectResult')
|
elem = fromstring(body, 'CopyPartResult')
|
||||||
self.assertEquals(elem.find('LastModified').text, iso_format)
|
self.assertEquals(elem.find('LastModified').text, iso_format)
|
||||||
self.assertEquals(elem.find('ETag').text, '"%s"' % self.etag)
|
self.assertEquals(elem.find('ETag').text, '"%s"' % self.etag)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user