Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

imap4-utf-7 encoding not known #47

Open
cl-parsons opened this issue Feb 24, 2022 · 3 comments
Open

imap4-utf-7 encoding not known #47

cl-parsons opened this issue Feb 24, 2022 · 3 comments

Comments

@cl-parsons
Copy link

cl-parsons commented Feb 24, 2022

OS : Debian Bullseye (11.2)
Python : 3.9.2
Virtualenv : Yes

### How to reproduce :

Modoboa installed and working flawlessly

Modoboa-sievefilters activated

Create a filter and try to add a rule -> Internal Server Error

Log :

Internal Server Error: /sfilters/main/newfilter/

LookupError at /sfilters/main/newfilter/
unknown encoding: imap4-utf-7

Request Method: GET
Request URL: https://listonmail.fr/sfilters/main/newfilter/
Django Version: 2.2.27
Python Executable: /usr/bin/python3
Python Version: 3.9.2
Python Path: ['/opt/modoboa/listonmail_fr', '/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages']
Server time: Thu, 24 Feb 2022 13:32:35 +0100
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'reversion',
 'ckeditor',
 'ckeditor_uploader',
 'rest_framework',
 'rest_framework.authtoken',
 'drf_spectacular',
 'phonenumber_field',
 'django_otp',
 'django_otp.plugins.otp_totp',
 'django_otp.plugins.otp_static',
 'modoboa',
 'modoboa.core',
 'modoboa.lib',
 'modoboa.admin',
 'modoboa.transport',
 'modoboa.relaydomains',
 'modoboa.limits',
 'modoboa.parameters',
 'modoboa.dnstools',
 'modoboa.policyd',
 'modoboa.maillog',
 'modoboa_sievefilters')
Installed Middleware:
('x_forwarded_for.middleware.XForwardedForMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django_otp.middleware.OTPMiddleware',
 'modoboa.core.middleware.TwoFAMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'modoboa.core.middleware.LocalConfigMiddleware',
 'modoboa.lib.middleware.AjaxLoginRedirect',
 'modoboa.lib.middleware.CommonExceptionCatcher',
 'modoboa.lib.middleware.RequestCatcherMiddleware')


Traceback:

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/lib/python3.9/contextlib.py" in inner
  79.                 return func(*args, **kwds)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa/admin/lib.py" in wrapped_f
  40.                 return f(request, *args, **kwargs)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/views.py" in newfilter
  164.     form = FilterForm(conds, actions, request)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/forms.py" in __init__
  56.             getattr(self, "_build_%s_field" % a[0])(request, *a[1:])

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/forms.py" in _build_fileinto_field
  137.         self._build_action_field(request, "fileinto", *values)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/forms.py" in _build_action_field
  124.                 choices = getattr(self, arg["vloader"])(request)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/forms.py" in userfolders
  160.         ret = mbc.getmboxes(request.user)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/imaputils.py" in getmboxes
  228.         self._listmboxes(topmailbox, md_mailboxes)

File "/opt/modoboa/venv_2.0.0-beta.3/lib/python3.9/site-packages/modoboa_sievefilters/imaputils.py" in _listmboxes
  184.             name = name.decode("imap4-utf-7")

Exception Type: LookupError at /sfilters/main/newfilter/
Exception Value: unknown encoding: imap4-utf-7

Proposal to resolve

apt-get install python3-imaplib2

Things to improve

Add the instruction to the documentation.

@cl-parsons
Copy link
Author

cl-parsons commented Feb 24, 2022

Ok, I continued my test and the installation of imaplib2 does not resolve the problem.

If I do the following :

abc = bytearray('foobar', 'utf-8')
abc.decode('imap4-utf-7')

I get the error.

If I do

abc = bytearray()
abc.decode('imap4-utf-7')

It returns the empty string.

@cl-parsons cl-parsons changed the title imaplib2 is not installed by defaut on Debian Bullseye (imap4-utf7 encoding not known) imap4-utf-7 encoding not known Feb 24, 2022
@cl-parsons
Copy link
Author

I edited the issue because it turns out that I was not testing it well...

@cl-parsons
Copy link
Author

cl-parsons commented Feb 24, 2022

Links to the following issue in modoboa main repo :

modoboa/modoboa-webmail#227 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant