nextcloud / nextcloud/mail

Rework message body decoding

Open
#7,746 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop skill:backend technical debt
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

We got some reports about broken preview texts:

https://github.com/nextcloud/mail/issues/7408
https://github.com/nextcloud/mail/issues/7497#issuecomment-1311073366
https://github.com/nextcloud/mail/issues/7687

After https://github.com/nextcloud/mail/pull/7709 the preview text should work. The only downside is that the decoding is done in Nextcloud Mail although the IMAP server could do it.

https://github.com/nextcloud/mail/blob/4fa038ddf26c30231358ce1078623ed501f30fa3/lib/IMAP/MessageMapper.php#L705-L708

@miaulalala discovered that decode = true don't work when the IMAP server does not support the binary extension.^1

The inaccuracy within our current code is to use content-transfer-encoding to decode the message. content-transfer-encoding stays the same regardless if the IMAP server is requested to decode a message or not.

To use server-side decoding, we need to know if the message body was decoded by the IMAP server: Horde_Imap_Client_Data_Fetch.getBodyPartDecode.^3

Todo: Rework the existing code to use server-side decoding.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/IMAP/MessageMapper.php around lines 705-708 and review the referenced Horde examples for getBodyPartDecode. Trace the existing preview decoding and verify behavior with and without IMAP binary-extension support. Done means server-side decoding is used correctly and preview text remains accurate for the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.