Fix error 500 on non-ASCII attachment file names

This commit is contained in:
Raphael Michel
2021-11-09 11:54:44 +01:00
parent b0ae40c264
commit dd0a4df914
3 changed files with 3 additions and 3 deletions

View File

@@ -69,7 +69,7 @@ class ExportersMixin:
cf = get_object_or_404(CachedFile, id=kwargs['cfid'])
if cf.file:
resp = ChunkBasedFileResponse(cf.file.file, content_type=cf.type)
resp['Content-Disposition'] = 'attachment; filename="{}"'.format(cf.filename)
resp['Content-Disposition'] = 'attachment; filename="{}"'.format(cf.filename).encode("ascii", "ignore")
return resp
elif not settings.HAS_CELERY:
return Response(