nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
819 stars 255 forks source link

Error when marking multiple messages as spam #9718

Open sgofferj opened 3 weeks ago

sgofferj commented 3 weeks ago

Steps to reproduce

  1. Select multiple messages
  2. Mark as spam

Expected behavior

Mail should mark all selected messages as spam and move them to the junk follder

Actual behavior

Mail marks and moves one message

Mail app version

3.7.1

Mailserver or service

postfix/cyrus

Operating system

Linux/docker

PHP engine version

PHP 8.2

Web server

Nginx

Database

MariaDB

Additional info

Log:

{
    "reqId": "hRC9q1s3nKwVvCDDY2f6",
    "level": 3,
    "time": "2024-06-07T08:04:48+00:00",
    "remoteAddr": "192.168.10.1",
    "user": "sgofferj",
    "app": "PHP",
    "method": "PUT",
    "url": "/index.php/api/messages/12211/flags",
    "message": "Undefined array key 64539 at /var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php#344",
    "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0",
    "version": "28.0.6.1",
    "data": {
        "app": "PHP"
    }
}
{
    "reqId": "hRC9q1s3nKwVvCDDY2f6",
    "level": 3,
    "time": "2024-06-07T08:04:48+00:00",
    "remoteAddr": "192.168.10.1",
    "user": "sgofferj",
    "app": "mail",
    "method": "PUT",
    "url": "/index.php/api/messages/12211/flags",
    "message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
    "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0",
    "version": "28.0.6.1",
    "exception": {
        "Exception": "Exception",
        "Message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/html/lib/private/AppFramework/App.php",
                "line": 184,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [
                    [
                        "OCA\\Mail\\Controller\\MessagesController"
                    ],
                    "setFlags"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Route/Router.php",
                "line": 315,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::",
                "args": [
                    "OCA\\Mail\\Controller\\MessagesController",
                    "setFlags",
                    [
                        "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    ],
                    [
                        "12211",
                        "mail.messages.setFlags"
                    ]
                ]
            },
            {
                "file": "/var/www/html/lib/base.php",
                "line": 1069,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->",
                "args": [
                    "/apps/mail/api/messages/12211/flags"
                ]
            },
            {
                "file": "/var/www/html/index.php",
                "line": 39,
                "function": "handleRequest",
                "class": "OC",
                "type": "::",
                "args": []
            }
        ],
        "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "Line": 169,
        "Previous": {
            "Exception": "TypeError",
            "Message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned",
            "Code": 0,
            "Trace": [
                {
                    "file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
                    "line": 410,
                    "function": "move",
                    "class": "OCA\\Mail\\IMAP\\MessageMapper",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\IMAP\\ImapClientRateLimitingDecorator",
                            [
                                "HICenv",
                                "HICflags",
                                "HIChdrs",
                                "HICdate",
                                "HICsize",
                                "And 1 more entries, set log level to debug to see all entries"
                            ],
                            true,
                            true
                        ],
                        "INBOX",
                        64539,
                        "INBOX.SPAM"
                    ]
                },
                {
                    "file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
                    "line": 305,
                    "function": "moveMessageOnSameAccount",
                    "class": "OCA\\Mail\\Service\\MailManager",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Account"
                        ],
                        "INBOX",
                        "INBOX.SPAM",
                        64539
                    ]
                },
                {
                    "file": "/var/www/html/custom_apps/mail/lib/Listener/MoveJunkListener.php",
                    "line": 73,
                    "function": "moveMessage",
                    "class": "OCA\\Mail\\Service\\MailManager",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Account"
                        ],
                        "INBOX",
                        64539,
                        [
                            "OCA\\Mail\\Account"
                        ],
                        "INBOX.SPAM"
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php",
                    "line": 86,
                    "function": "handle",
                    "class": "OCA\\Mail\\Listener\\MoveJunkListener",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Events\\MessageFlaggedEvent"
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
                    "line": 230,
                    "function": "__invoke",
                    "class": "OC\\EventDispatcher\\ServiceEventListener",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Events\\MessageFlaggedEvent"
                        ],
                        "OCA\\Mail\\Events\\MessageFlaggedEvent",
                        [
                            "Symfony\\Component\\EventDispatcher\\EventDispatcher"
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
                    "line": 59,
                    "function": "callListeners",
                    "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
                    "type": "->",
                    "args": [
                        [
                            [
                                "Closure"
                            ],
                            [
                                "Closure"
                            ],
                            [
                                "Closure"
                            ],
                            [
                                "Closure"
                            ]
                        ],
                        "OCA\\Mail\\Events\\MessageFlaggedEvent",
                        [
                            "OCA\\Mail\\Events\\MessageFlaggedEvent"
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
                    "line": 94,
                    "function": "dispatch",
                    "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Events\\MessageFlaggedEvent"
                        ],
                        "OCA\\Mail\\Events\\MessageFlaggedEvent"
                    ]
                },
                {
                    "file": "/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
                    "line": 491,
                    "function": "dispatch",
                    "class": "OC\\EventDispatcher\\EventDispatcher",
                    "type": "->",
                    "args": [
                        "OCA\\Mail\\Events\\MessageFlaggedEvent",
                        [
                            "OCA\\Mail\\Events\\MessageFlaggedEvent"
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/custom_apps/mail/lib/Controller/MessagesController.php",
                    "line": 799,
                    "function": "flagMessage",
                    "class": "OCA\\Mail\\Service\\MailManager",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Account"
                        ],
                        "INBOX",
                        64539,
                        "$junk",
                        true
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                    "line": 230,
                    "function": "setFlags",
                    "class": "OCA\\Mail\\Controller\\MessagesController",
                    "type": "->",
                    "args": [
                        12211,
                        [
                            true,
                            false
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                    "line": 137,
                    "function": "executeController",
                    "class": "OC\\AppFramework\\Http\\Dispatcher",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Controller\\MessagesController"
                        ],
                        "setFlags"
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/AppFramework/App.php",
                    "line": 184,
                    "function": "dispatch",
                    "class": "OC\\AppFramework\\Http\\Dispatcher",
                    "type": "->",
                    "args": [
                        [
                            "OCA\\Mail\\Controller\\MessagesController"
                        ],
                        "setFlags"
                    ]
                },
                {
                    "file": "/var/www/html/lib/private/Route/Router.php",
                    "line": 315,
                    "function": "main",
                    "class": "OC\\AppFramework\\App",
                    "type": "::",
                    "args": [
                        "OCA\\Mail\\Controller\\MessagesController",
                        "setFlags",
                        [
                            "OC\\AppFramework\\DependencyInjection\\DIContainer"
                        ],
                        [
                            "12211",
                            "mail.messages.setFlags"
                        ]
                    ]
                },
                {
                    "file": "/var/www/html/lib/base.php",
                    "line": 1069,
                    "function": "match",
                    "class": "OC\\Route\\Router",
                    "type": "->",
                    "args": [
                        "/apps/mail/api/messages/12211/flags"
                    ]
                },
                {
                    "file": "/var/www/html/index.php",
                    "line": 39,
                    "function": "handleRequest",
                    "class": "OC",
                    "type": "::",
                    "args": []
                }
            ],
            "File": "/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php",
            "Line": 344
        },
        "message": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344",
        "exception": {},
        "CustomMessage": "OCA\\Mail\\IMAP\\MessageMapper::move(): Return value must be of type int, null returned in file '/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php' line 344"
    }
}
sgofferj commented 3 weeks ago

Actually, it seems that I handled those messages already on my tablet and mail somehow hasn't figured out that they are gone. occ mail:accout:sync doesn't help...

sgofferj commented 3 weeks ago

Possibly related:

8223

9168