From 0f961d850155f8185a63a9c868c094638515fd67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 12 May 2023 09:35:58 +0200 Subject: [PATCH] Trim the human readable name of a Mailbox Whitespace around the name is going to be a little wonky and this is in preparation of a future change that detects and suppresses empty names. --- wcfsetup/install/files/lib/system/email/Mailbox.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/email/Mailbox.class.php b/wcfsetup/install/files/lib/system/email/Mailbox.class.php index d350a3f680..038577fb27 100644 --- a/wcfsetup/install/files/lib/system/email/Mailbox.class.php +++ b/wcfsetup/install/files/lib/system/email/Mailbox.class.php @@ -6,6 +6,7 @@ use TrueBV\Exception\OutOfBoundsException; use TrueBV\Punycode; use wcf\data\language\Language; use wcf\system\language\LanguageFactory; +use wcf\util\StringUtil; /** * Represents a RFC 5322 mailbox. @@ -47,7 +48,7 @@ class Mailbox public function __construct($address, $name = null, ?Language $language = null) { $this->address = self::filterAddress($address); - $this->name = $name; + $this->name = $name !== null ? StringUtil::trim($name) : null; if ($language === null) { $this->languageID = LanguageFactory::getInstance()->getDefaultLanguageID(); } else { -- 2.20.1