diff --git a/binder/views.py b/binder/views.py index c12c1760..1cbf7750 100644 --- a/binder/views.py +++ b/binder/views.py @@ -9,6 +9,7 @@ import functools from collections import defaultdict, namedtuple from contextlib import ExitStack +from unidecode import unidecode from PIL import Image from inspect import getmro @@ -2268,7 +2269,8 @@ def dispatch_file_field(self, request, pk=None, file_field=None): raise BinderNotFound(file_field_name) if 'download' in request.GET: - filename = self.filefield_get_name(instance=obj, request=request, file_field=file_field) + # unidecode in order to prevent weird utf-8 symbols from messing with our urls, causing issues + filename = unidecode(self.filefield_get_name(instance=obj, request=request, file_field=file_field)) if 'prefix' in request.GET: filename = request.GET['prefix'] + ' - ' + filename resp['Content-Disposition'] = 'attachment; filename="{}"'.format(filename) diff --git a/setup.py b/setup.py index 31a0f90f..04fe562b 100755 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ 'Pillow >= 3.2.0', 'django-request-id >= 1.0.0', 'requests >= 2.13.0', + 'unidecode >= 1.2.0' ], tests_require=[ 'django-hijack >= 2.1.10',