Merge pull request #25585 from nextcloud/enhancement/empty-email-validation
Micro-optimize validation of empty email addresses
This commit is contained in:
commit
37199c1da0
|
@ -221,6 +221,10 @@ class Mailer implements IMailer {
|
|||
* @return bool True if the mail address is valid, false otherwise
|
||||
*/
|
||||
public function validateMailAddress(string $email): bool {
|
||||
if ($email === '') {
|
||||
// Shortcut: empty addresses are never valid
|
||||
return false;
|
||||
}
|
||||
$validator = new EmailValidator();
|
||||
$validation = new RFCValidation();
|
||||
|
||||
|
|
|
@ -178,6 +178,7 @@ class MailerTest extends TestCase {
|
|||
['lukas@192.168.1.1', true],
|
||||
['lukas@éxämplè.com', true],
|
||||
['asdf', false],
|
||||
['', false],
|
||||
['lukas@owncloud.org@owncloud.com', false],
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue