Merge "Fix response of PUT Object Copy requests"

This commit is contained in:
Jenkins
2015-01-15 02:26:57 +00:00
committed by Gerrit Code Review
2 changed files with 51 additions and 31 deletions

View File

@@ -17,8 +17,7 @@ from swift.common.http import HTTP_OK
from swift.common.swob import Range, content_range_header_value
from swift3.controllers.base import Controller
from swift3.response import HTTPOk, S3NotImplemented, InvalidRange,\
HTTPPartialContent
from swift3.response import S3NotImplemented, InvalidRange, HTTPPartialContent
from swift3.etree import Element, SubElement, tostring
@@ -99,9 +98,12 @@ class ObjectController(Controller):
if 'X-Amz-Copy-Source' in req.headers:
elem = Element('CopyObjectResult')
SubElement(elem, 'LastModified').text = \
resp.last_modified.isoformat()[:-6] + '.000Z'
SubElement(elem, 'ETag').text = '"%s"' % resp.etag
body = tostring(elem, use_s3ns=False)
return HTTPOk(body=body, headers=resp.headers)
resp.body = tostring(elem)
resp.headers['Content-Type'] = 'application/xml'
resp.etag = None
resp.status = HTTP_OK
return resp