From 6237a3691bd40c5e4ea5edde245445ecffb5a014 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sun, 12 Feb 2023 01:02:55 +0100 Subject: [PATCH] Resolve #950 --- dev/Model/Email.js | 6 +++--- snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php | 2 +- .../v/0.0.0/app/libraries/MailSo/Mime/HeaderCollection.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/Model/Email.js b/dev/Model/Email.js index 30c613ee9..9217cb7a8 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -302,7 +302,7 @@ export class EmailModel extends AbstractModel { * @returns {string} */ hash(withoutName = false) { - return '#' + (withoutName ? '' : this.name) + '#' + this.email + '#'; + return '#' + (withoutName ? '' : this.name) + '#' + (this.email || this.name) + '#'; } /** @@ -328,8 +328,8 @@ export class EmailModel extends AbstractModel { * @returns {string} */ toLine(friendlyView, wrapWithLink) { - let result = this.email, - name = this.name, + let name = this.name, + result = this.email || name, toLink = text => '') : '') diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php index 599bad2ce..fbb5de7ec 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/Email.php @@ -28,7 +28,7 @@ class Email implements \JsonSerializable */ function __construct(string $sEmail, string $sDisplayName = '') { - if (!\strlen(\trim($sEmail))) { + if (!\strlen(\trim($sEmail)) && !\strlen(\trim($sDisplayName))) { throw new \InvalidArgumentException; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/HeaderCollection.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/HeaderCollection.php index 893167385..0e9adfdc7 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mime/HeaderCollection.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mime/HeaderCollection.php @@ -81,7 +81,7 @@ class HeaderCollection extends \MailSo\Base\Collection if (\strlen($sValue)) { $oResult = new EmailCollection($sValue); } - return $oResult && $oResult->count() ? $oResult : null; + return $oResult; } public function ParametersByName(string $sHeaderName) : ?ParameterCollection