mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-27 03:54:01 +03:00
commit
f6329b7b5d
|
@ -288,7 +288,7 @@ class FileUploadParser(BaseParser):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
meta = parser_context['request'].META
|
meta = parser_context['request'].META
|
||||||
disposition = parse_header(meta['HTTP_CONTENT_DISPOSITION'])
|
disposition = parse_header(meta['HTTP_CONTENT_DISPOSITION'].encode('utf-8'))
|
||||||
return disposition[1]['filename']
|
return disposition[1]['filename']
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -96,7 +96,7 @@ class TestFileUploadParser(TestCase):
|
||||||
request = MockRequest()
|
request = MockRequest()
|
||||||
request.upload_handlers = (MemoryFileUploadHandler(),)
|
request.upload_handlers = (MemoryFileUploadHandler(),)
|
||||||
request.META = {
|
request.META = {
|
||||||
'HTTP_CONTENT_DISPOSITION': 'Content-Disposition: inline; filename=file.txt'.encode('utf-8'),
|
'HTTP_CONTENT_DISPOSITION': 'Content-Disposition: inline; filename=file.txt',
|
||||||
'HTTP_CONTENT_LENGTH': 14,
|
'HTTP_CONTENT_LENGTH': 14,
|
||||||
}
|
}
|
||||||
self.parser_context = {'request': request, 'kwargs': {}}
|
self.parser_context = {'request': request, 'kwargs': {}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user