modoboa / modoboa

Mail hosting made simple
https://modoboa.org
ISC License
3.01k stars 393 forks source link

Internal Error trying to Reply #3174

Open pgehres opened 7 months ago

pgehres commented 7 months ago

Impacted versions

Steps to reproduce

  1. Run installer
  2. Login with admin:password
  3. Add domain and super user with mailbox
  4. Receive email
  5. Attempt to reply

Current behavior

Screenshot 2024-01-27 at 3 09 44 PM
Traceback (most recent call last):
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/srv/modoboa/env/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
    return view_func(request, *args, **kwargs)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa/admin/lib.py", line 47, in wrapped_f
    return f(request, *args, **kwargs)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/views.py", line 656, in index
    response = globals()[action](request)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/views.py", line 523, in reply
    return new_compose_form(request, "reply", mbox, mailid)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/views.py", line 508, in new_compose_form
    email = modclass(form, request, "%s:%s" % (mbox, mailid), links=True)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/lib/imapemail.py", line 282, in __init__
    super().__init__(*args, **kwargs)
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/lib/imapemail.py", line 257, in __init__
    getattr(self, "_modify_%s" % self.dformat)()
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/lib/imapemail.py", line 312, in _modify_plain
    super(ReplyModifier, self)._modify_plain()
  File "/srv/modoboa/env/lib/python3.10/site-packages/modoboa_webmail/lib/imapemail.py", line 260, in _modify_plain
    self.body = re.sub("</?pre>", "", self.body)
  File "/usr/lib/python3.10/re.py", line 209, in sub
    return _compile(pattern, flags).sub(repl, string, count)

Exception Type: TypeError at /webmail/
Exception Value: expected string or bytes-like object

Expected behavior

I can reply to an email.

Video/Screenshot link (optional)

I can reliably reproduce this. Happy to provide additional information or perform additional debugging.

tonioo commented 7 months ago

Is there anything special with the email you're trying to reply to?

pgehres commented 7 months ago

Not at all. It was a plaintext email with a subject line like "TEST" sent from one instance of modoboa to another.