summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-01-11 15:59:57 +0100
committerCarl Schwan <carl@carlschwan.eu>2022-01-11 20:59:44 +0100
commit7ecb65f725d7243d3f1433bb8d2cd1f981c90c07 (patch)
treea32be16a82b5f07c529faf82aca2982400917646 /apps/sharebymail/lib
parentd4a5e480ab9fb2337909f1be3c30048a8eb14d78 (diff)
downloadnextcloud-server-7ecb65f725d7243d3f1433bb8d2cd1f981c90c07.tar.gz
nextcloud-server-7ecb65f725d7243d3f1433bb8d2cd1f981c90c07.zip
Add check before sending email that email address is valid
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 62ba9d35f3f..65a7498bcd6 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -334,6 +334,16 @@ class ShareByMailProvider implements IShareProvider {
$share->getNote()
);
+ if ($this->mailer->validateMailAddress($share->getSharedWith())) {
+ $this->removeShareFromTable($shareId);
+ $e = new HintException('Failed to send share by mail. Got an invalid email address: ' . $share->getSharedWith(),
+ $this->l->t('Failed to send share by email. Got an invalid email address'));
+ $this->logger->error($e->getMessage(), [
+ 'message' => 'Failed to send share by mail. Got an invalid email address ' . $share->getSharedWith(),
+ 'app' => 'sharebymail',
+ ]);
+ }
+
try {
$link = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare',
['token' => $share->getToken()]);