Fixes swift3 middleware so that container listings work correctly with utf-8 encoded container names.

This commit is contained in:
FUJITA Tomonori 2011-01-19 04:07:27 +00:00 committed by Tarmac
commit 1abfc07bc7

View File

@ -139,11 +139,9 @@ class ServiceController(Controller):
return get_err_response('InvalidURI') return get_err_response('InvalidURI')
containers = loads(''.join(list(body_iter))) containers = loads(''.join(list(body_iter)))
resp = Response(content_type='text/xml')
resp.status = 200
# we don't keep the creation time of a backet (s3cmd doesn't # we don't keep the creation time of a backet (s3cmd doesn't
# work without that) so we use something bogus. # work without that) so we use something bogus.
resp.body = '<?xml version="1.0" encoding="UTF-8"?>' \ body = '<?xml version="1.0" encoding="UTF-8"?>' \
'<ListAllMyBucketsResult ' \ '<ListAllMyBucketsResult ' \
'xmlns="http://doc.s3.amazonaws.com/2006-03-01">' \ 'xmlns="http://doc.s3.amazonaws.com/2006-03-01">' \
'<Buckets>%s</Buckets>' \ '<Buckets>%s</Buckets>' \
@ -151,6 +149,7 @@ class ServiceController(Controller):
% ("".join(['<Bucket><Name>%s</Name><CreationDate>' \ % ("".join(['<Bucket><Name>%s</Name><CreationDate>' \
'2009-02-03T16:45:09.000Z</CreationDate></Bucket>' % '2009-02-03T16:45:09.000Z</CreationDate></Bucket>' %
xml_escape(i['name']) for i in containers])) xml_escape(i['name']) for i in containers]))
resp = Response(status=200, content_type='text/xml', body=body)
return resp return resp