summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/share/mailnotifications.php4
-rw-r--r--tests/lib/share/MailNotificationsTest.php22
2 files changed, 22 insertions, 4 deletions
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php
index f45d80b37ca..4d282158ba4 100644
--- a/lib/private/share/mailnotifications.php
+++ b/lib/private/share/mailnotifications.php
@@ -176,10 +176,12 @@ class MailNotifications {
$subject = (string)$this->l->t('%s shared »%s« with you', [$this->senderDisplayName, $filename]);
list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration);
+ $recipient = str_replace([', ', '; ', ',', ';', ' '], ',', $recipient);
+ $recipients = explode(',', $recipient);
try {
$message = $this->mailer->createMessage();
$message->setSubject($subject);
- $message->setTo([$recipient]);
+ $message->setTo($recipients);
$message->setHtmlBody($htmlBody);
$message->setPlainBody($textBody);
$message->setFrom([
diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php
index 2124a8bf13b..8684886e798 100644
--- a/tests/lib/share/MailNotificationsTest.php
+++ b/tests/lib/share/MailNotificationsTest.php
@@ -123,7 +123,23 @@ class MailNotificationsTest extends \Test\TestCase {
$this->assertSame([], $mailNotifications->sendLinkShareMail('lukas@owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
}
- public function testSendLinkShareMailWithReplyTo() {
+ public function dataSendLinkShareMailWithReplyTo() {
+ return [
+ ['lukas@owncloud.com', ['lukas@owncloud.com']],
+ ['lukas@owncloud.com nickvergessen@owncloud.com', ['lukas@owncloud.com', 'nickvergessen@owncloud.com']],
+ ['lukas@owncloud.com,nickvergessen@owncloud.com', ['lukas@owncloud.com', 'nickvergessen@owncloud.com']],
+ ['lukas@owncloud.com, nickvergessen@owncloud.com', ['lukas@owncloud.com', 'nickvergessen@owncloud.com']],
+ ['lukas@owncloud.com;nickvergessen@owncloud.com', ['lukas@owncloud.com', 'nickvergessen@owncloud.com']],
+ ['lukas@owncloud.com; nickvergessen@owncloud.com', ['lukas@owncloud.com', 'nickvergessen@owncloud.com']],
+ ];
+ }
+
+ /**
+ * @dataProvider dataSendLinkShareMailWithReplyTo
+ * @param string $to
+ * @param array $expectedTo
+ */
+ public function testSendLinkShareMailWithReplyTo($to, array $expectedTo) {
$message = $this->getMockBuilder('\OC\Mail\Message')
->disableOriginalConstructor()->getMock();
@@ -134,7 +150,7 @@ class MailNotificationsTest extends \Test\TestCase {
$message
->expects($this->once())
->method('setTo')
- ->with(['lukas@owncloud.com']);
+ ->with($expectedTo);
$message
->expects($this->once())
->method('setHtmlBody');
@@ -167,7 +183,7 @@ class MailNotificationsTest extends \Test\TestCase {
$this->logger,
$this->defaults
);
- $this->assertSame([], $mailNotifications->sendLinkShareMail('lukas@owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
+ $this->assertSame([], $mailNotifications->sendLinkShareMail($to, 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
}
public function testSendLinkShareMailException() {