[GH-ISSUE #459] Downloading/exporting filters with unicode fails #444

Closed
opened 2026-02-27 11:11:48 +03:00 by kerem · 1 comment
Owner

Originally created by @tonioo on GitHub (Dec 4, 2013).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/459

Originally assigned to: @tonioo on GitHub.

Originally created by Miroslav Abrahám on 2013-09-10T18:10:49Z

Exporting filter sets with unicode chars in name may fail with this error:

Traceback:
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/contrib/auth/decorators.py" in _wrapped_view
  25.                 return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/modoboa-1.0.0-py2.7.egg/modoboa/lib/decorators.py" in wrapped_f
  19.                 return f(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/modoboa-1.0.0-py2.7.egg/modoboa/extensions/sievefilters/views.py" in download_filters_set
  266.     resp["Content-Disposition"] = 'attachment; filename="%s.txt"' % name
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/http/response.py" in __setitem__
  110.         value = self._convert_to_charset(value, 'latin1', mime_encode=True)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/http/response.py" in _convert_to_charset
  105.             raise BadHeaderError("Header values can't contain newlines (got %r)" % value)

Exception Type: BadHeaderError at /sfilters/downloadfs/ršwr šř ščěřěš/
Exception Value: Header values can't contain newlines (got '=?utf-8?b?YXR0YWNobWVudDsgZmlsZW5hbWU9InLFoXdyIMWhxZkgxaHEjcSbxZnEm8Wh?=\n =?utf-8?b?LnR4dCI=?=')

There obviously is no new line in my filters.

Trying to play with a little bit more, clicking on the download link when the filter set does contain unicode chars may also result in a file not having any name. While in Chrome the file opens directly, in Firefox for instance it has no name preset (see the attached picture).

Originally created by @tonioo on GitHub (Dec 4, 2013). Original GitHub issue: https://github.com/modoboa/modoboa/issues/459 Originally assigned to: @tonioo on GitHub. **Originally created by Miroslav Abrahám on 2013-09-10T18:10:49Z** Exporting filter sets with unicode chars in name may fail with this error: <pre> Traceback: File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/core/handlers/base.py" in get_response 115. response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/contrib/auth/decorators.py" in _wrapped_view 25. return view_func(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/modoboa-1.0.0-py2.7.egg/modoboa/lib/decorators.py" in wrapped_f 19. return f(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/modoboa-1.0.0-py2.7.egg/modoboa/extensions/sievefilters/views.py" in download_filters_set 266. resp["Content-Disposition"] = 'attachment; filename="%s.txt"' % name File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/http/response.py" in __setitem__ 110. value = self._convert_to_charset(value, 'latin1', mime_encode=True) File "/usr/local/lib/python2.7/dist-packages/Django-1.5.2-py2.7.egg/django/http/response.py" in _convert_to_charset 105. raise BadHeaderError("Header values can't contain newlines (got %r)" % value) Exception Type: BadHeaderError at /sfilters/downloadfs/ršwr šř ščěřěš/ Exception Value: Header values can't contain newlines (got '=?utf-8?b?YXR0YWNobWVudDsgZmlsZW5hbWU9InLFoXdyIMWhxZkgxaHEjcSbxZnEm8Wh?=\n =?utf-8?b?LnR4dCI=?=') </pre> There obviously is no new line in my filters. Trying to play with a little bit more, clicking on the download link when the filter set does contain unicode chars may also result in a file not having any name. While in Chrome the file opens directly, in Firefox for instance it has no name preset (see the attached picture).
kerem 2026-02-27 11:11:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Dec 4, 2013):

Posted by Antoine Nguyen on 2013-09-17T06:44:24Z

Applied in changeset commit:5e87fc764c4599d24929b500c242619aa5a2a803.

<!-- gh-comment-id:29816734 --> @tonioo commented on GitHub (Dec 4, 2013): **Posted by Antoine Nguyen on 2013-09-17T06:44:24Z** Applied in changeset commit:5e87fc764c4599d24929b500c242619aa5a2a803.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#444
No description provided.