diff options
Diffstat (limited to 'django/http/response.py')
| -rw-r--r-- | django/http/response.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/http/response.py b/django/http/response.py index 1c22edaff3..73f87d7bda 100644 --- a/django/http/response.py +++ b/django/http/response.py @@ -485,7 +485,9 @@ class FileResponse(StreamingHttpResponse): disposition = 'attachment' if self.as_attachment else 'inline' try: filename.encode('ascii') - file_expr = 'filename="{}"'.format(filename) + file_expr = 'filename="{}"'.format( + filename.replace('\\', '\\\\').replace('"', r'\"') + ) except UnicodeEncodeError: file_expr = "filename*=utf-8''{}".format(quote(filename)) self.headers['Content-Disposition'] = '{}; {}'.format(disposition, file_expr) |
