Commit 41344f05 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Fix further unicode issues

parent a268f327
...@@ -102,7 +102,8 @@ class ObjectGetView(PithosAPITest): ...@@ -102,7 +102,8 @@ class ObjectGetView(PithosAPITest):
def setUp(self): def setUp(self):
PithosAPITest.setUp(self) PithosAPITest.setUp(self)
self.cname = self.create_container()[0] self.cname = self.create_container()[0]
self.oname, self.odata = self.upload_object(self.cname)[:-1] self.oname, self.odata = self.upload_object(self.cname,
'φωτογραφία.JPG')[:-1]
self.view_path = join_urls(get_service_path( self.view_path = join_urls(get_service_path(
pithos_settings.pithos_services, 'pithos_ui'), 'view') pithos_settings.pithos_services, 'pithos_ui'), 'view')
...@@ -141,6 +142,20 @@ class ObjectGetView(PithosAPITest): ...@@ -141,6 +142,20 @@ class ObjectGetView(PithosAPITest):
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
self.assertTrue(r.content, self.odata) self.assertTrue(r.content, self.odata)
r = self.get('%s&disposition-type=inline' %
add_url_params(self.view_url, access_token='valid_token'))
self.assertEqual(r.status_code, 200)
self.assertTrue(r.content, self.odata)
self.assertTrue('Content-Disposition' in r)
self.assertTrue('inline' in r['Content-Disposition'])
r = self.get('%s&disposition-type=attachment' %
add_url_params(self.view_url, access_token='valid_token'))
self.assertEqual(r.status_code, 200)
self.assertTrue(r.content, self.odata)
self.assertTrue('Content-Disposition' in r)
self.assertTrue('attachment' in r['Content-Disposition'])
def test_forbidden(self): def test_forbidden(self):
container = self.create_container(user='alice')[0] container = self.create_container(user='alice')[0]
obj = self.upload_object(container, user='alice')[0] obj = self.upload_object(container, user='alice')[0]
......
...@@ -260,8 +260,8 @@ def put_object_headers(response, meta, restricted=False, token=None, ...@@ -260,8 +260,8 @@ def put_object_headers(response, meta, restricted=False, token=None,
disposition_type = disposition_type if disposition_type in \ disposition_type = disposition_type if disposition_type in \
('inline', 'attachment') else None ('inline', 'attachment') else None
if disposition_type is not None: if disposition_type is not None:
response['Content-Disposition'] = '%s; filename=%s' % ( response['Content-Disposition'] = smart_str('%s; filename=%s' % (
disposition_type, meta['name']) disposition_type, meta['name']), strings_only=True)
def update_manifest_meta(request, v_account, meta): def update_manifest_meta(request, v_account, meta):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment