isSenderTrusted incorrect
@kesselb is already working on this.
Since May 5, 2026.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 348
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 91
Description
Expected behavior
Tell us what should happen
Once I select 'Always show images from ' I shouldn't have to again.
Actual behavior
Tell us what happens instead
the apps/mail/api/messages/*/body call is returning isSenderTrusted = false. If I select 'always show images' again, it displays the images but gets a duplicate entry error on the server on index mail_trusted_sender_uniq.
Mail app
Mail app version: (see apps admin page, e.g. 0.5.3)
1.9.5
Mailserver or service: (e.g. Outlook, Yahoo, Gmail, Exchange,...)
gmail & smtp
Server configuration
Operating system: (e.g. Debian 8)
Ubuntu 20
Web server: (e.g. Apache, Nginx,...)
Apache2
Database: (e.g. MariaDB, SQLite or PostgreSQL)
MariaDB
PHP version: (e.g. 7.0)
8.0
Nextcloud Version: (see admin page, e.g. 13.0.2)
21.0.2
Client configuration
Browser: (e.g. Firefox 48)
Chrome 91.0.4472.77
Operating system: (e.g. Arch Linux)
Ubuntu 20
... Here's the error log entry:
{"reqId":"hvjirBJWk1G0Hkf4dSa8","level":3,"time":"2021-06-08T15:22:32+00:00","remoteAddr":"64.201.232.47","user":"rmiller","app":"mail","method":"PUT","url":"/index.php/apps/mail/api/trustedsenders/ronjonsurfshop.info?type=domain","message":{"Exception":"Doctrine\DBAL\Exception\UniqueConstraintViolationException","Message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'ronjonsurfshop.info-rmiller' for key 'mail_trusted_sender_uniq'","Code":1062,"Trace":[{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1728,"function":"convert","class":"Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1667,"function":"handleDriverException","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1146,"function":"convertExceptionDuringQuery","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/Connection.php","line":257,"function":"executeStatement","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":213,"function":"executeStatement","class":"OC\DB\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":287,"function":"execute","class":"Doctrine\DBAL\Query\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Db/TrustedSenderMapper.php","line":73,"function":"execute","class":"OC\DB\QueryBuilder\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Service/TrustedSenderService.php","line":55,"function":"create","class":"OCA\Mail\Db\TrustedSenderMapper","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Controller/TrustedSendersController.php","line":62,"function":"trust","class":"OCA\Mail\Service\TrustedSenderService","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"setTrusted","class":"OCA\Mail\Controller\TrustedSendersController","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/home/rmiller/Software/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/home/rmiller/Software/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":60,"Previous":{"Exception":"Doctrine\DBAL\Driver\PDO\Exception","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'ronjonsurfshop.info-rmiller' for key 'mail_trusted_sender_uniq'","Code":1062,"Trace":[{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":84,"function":"new","class":"Doctrine\DBAL\Driver\PDO\Exception","type":"::"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1136,"function":"execute","class":"Doctrine\DBAL\Driver\PDO\Statement","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/Connection.php","line":257,"function":"executeStatement","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":213,"function":"executeStatement","class":"OC\DB\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":287,"function":"execute","class":"Doctrine\DBAL\Query\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Db/TrustedSenderMapper.php","line":73,"function":"execute","class":"OC\DB\QueryBuilder\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Service/TrustedSenderService.php","line":55,"function":"create","class":"OCA\Mail\Db\TrustedSenderMapper","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Controller/TrustedSendersController.php","line":62,"function":"trust","class":"OCA\Mail\Service\TrustedSenderService","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"setTrusted","class":"OCA\Mail\Controller\TrustedSendersController","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/home/rmiller/Software/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/home/rmiller/Software/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":26,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'ronjonsurfshop.info-rmiller' for key 'mail_trusted_sender_uniq'","Code":"23000","Trace":[{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":82,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1136,"function":"execute","class":"Doctrine\DBAL\Driver\PDO\Statement","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/Connection.php","line":257,"function":"executeStatement","class":"Doctrine\DBAL\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":213,"function":"executeStatement","class":"OC\DB\Connection","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":287,"function":"execute","class":"Doctrine\DBAL\Query\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Db/TrustedSenderMapper.php","line":73,"function":"execute","class":"OC\DB\QueryBuilder\QueryBuilder","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Service/TrustedSenderService.php","line":55,"function":"create","class":"OCA\Mail\Db\TrustedSenderMapper","type":"->"},{"file":"/home/rmiller/Software/nextcloud/apps/mail/lib/Controller/TrustedSendersController.php","line":62,"function":"trust","class":"OCA\Mail\Service\TrustedSenderService","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"setTrusted","class":"OCA\Mail\Controller\TrustedSendersController","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/home/rmiller/Software/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/home/rmiller/Software/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/home/rmiller/Software/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/rmiller/Software/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":82}},"CustomMessage":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'ronjonsurfshop.info-rmiller' for key 'mail_trusted_sender_uniq'"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36","version":"21.0.2.1"}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.