mirror of
https://github.com/nextcloud/server.git
synced 2024-08-28 05:54:51 +02:00
Micro-optimize validation of empty email addresses
Then we don't have to construct any validators. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
d5dea10517
commit
883848b58a
@ -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
Block a user