Commit cc573a25 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Fix DjangoUnicodeDecodeError

parent 23f78cf7
......@@ -599,6 +599,13 @@ class ObjectPut(PithosAPITest):
meta = {'test': 'test1'}
headers = dict(('HTTP_X_OBJECT_META_%s' % k.upper(), v)
for k, v in meta.iteritems())
headers['HTTP_CONTENT_DISPOSITION'] = 'attachment; filename="%f2"'
url = join_urls(self.pithos_path, self.user, cname, oname)
r = self.put(url, data=data, content_type='application/pdf', **headers)
self.assertEqual(r.status_code, 400)
headers['HTTP_CONTENT_DISPOSITION'] = ('attachment; filename="%s"' %
oname)
url = join_urls(self.pithos_path, self.user, cname, oname)
r = self.put(url, data=data, content_type='application/pdf', **headers)
self.assertEqual(r.status_code, 201)
......
......@@ -1059,12 +1059,12 @@ def update_request_headers(request):
try:
k.decode('ascii')
v.decode('ascii')
if '%' in k or '%' in v:
del(request.META[k])
request.META[unquote(k)] = smart_unicode(unquote(
v), strings_only=True)
except UnicodeDecodeError:
raise faults.BadRequest('Bad character in headers.')
if '%' in k or '%' in v:
del(request.META[k])
request.META[unquote(k)] = smart_unicode(unquote(
v), strings_only=True)
def update_response_headers(request, response):
......
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