mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +00:00
UTF-8 fix
This commit is contained in:
parent
cfbb6f4e1f
commit
064abe0741
@ -36,11 +36,11 @@ def send_file(request, file_id, file_class=SithFile, file_attr="file"):
|
|||||||
):
|
):
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
name = f.__getattribute__(file_attr).name
|
name = f.__getattribute__(file_attr).name
|
||||||
with open(settings.MEDIA_ROOT + name, 'rb') as filename:
|
with open((settings.MEDIA_ROOT + name).encode('utf-8'), 'rb') as filename:
|
||||||
wrapper = FileWrapper(filename)
|
wrapper = FileWrapper(filename)
|
||||||
response = HttpResponse(wrapper, content_type=f.mime_type)
|
response = HttpResponse(wrapper, content_type=f.mime_type)
|
||||||
response['Content-Length'] = os.path.getsize(settings.MEDIA_ROOT + name)
|
response['Content-Length'] = os.path.getsize((settings.MEDIA_ROOT + name).encode('utf-8'))
|
||||||
response['Content-Disposition'] = 'inline; filename="%s"' % f.name
|
response['Content-Disposition'] = ('inline; filename="%s"' % f.name).encode('utf-8')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
class AddFilesForm(forms.Form):
|
class AddFilesForm(forms.Form):
|
||||||
|
Loading…
Reference in New Issue
Block a user