nextcloud / nextcloud/mail

Moving a messageid in MessageMapper will not always create a new message id (with patch)

Open
#9,060 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. to triage bug
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
  1. Mount a hMailServer
  2. With Maill App of NextCloud, delete a message
  3. You'll encouter an error message
Expected behavior

MessageMapper.php expects a filled array because it assumes a moved will have a different messageId, but it could be false ! Some IMAP server provide the same messageId or not provide the same messageId in case of moved message.

Actual behavior

MessageMapper.php try to get the new messageId into an empty array and crash.

Mail app version

3.4.4

Mailserver or service

hMailServer

Operating system

Linux (MailApp), Windows (hMailServer)

PHP engine version

None

Web server

None

Database

None

Additional info

Add a check into the code at line 334. The old code :
return $mapping[$messageId];
The new code :
if (empty($mapping))
return $messageId;
else
return $mapping[$messageId];
MessageMapper.zip

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

Open MessageMapper.php and inspect the message-move handling around line 334, then reproduce the deletion with a hMailServer mailbox as described. Done means the empty mapping case no longer crashes and the original message ID is returned when no new ID is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.