From 2d595777eb5252aeaa89bdfbafc203901686cf04 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Wed, 10 Oct 2018 15:12:27 +0100 Subject: [PATCH] Email subject is already escaped, avoid double escaping --- lib/private/Share/MailNotifications.php | 3 ++- tests/lib/Share/MailNotificationsTest.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php index b0f2d840d2aa..6cf2110d8d57 100644 --- a/lib/private/Share/MailNotifications.php +++ b/lib/private/Share/MailNotifications.php @@ -160,10 +160,11 @@ public function sendInternalShareMail($recipientList, $itemSource, $itemType) { 'file' => $filename, ]); + $unescapedFilename = $filename; $filename = $filter->getFile(); $link = $filter->getLink(); - $subject = (string) $this->l->t('%s shared »%s« with you', [$this->senderDisplayName, $filename]); + $subject = (string) $this->l->t('%s shared »%s« with you', [$this->senderDisplayName, $unescapedFilename]); list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, null, 'internal'); // send it out now diff --git a/tests/lib/Share/MailNotificationsTest.php b/tests/lib/Share/MailNotificationsTest.php index ccb4b4a2f2a4..b7e5580b4c4e 100644 --- a/tests/lib/Share/MailNotificationsTest.php +++ b/tests/lib/Share/MailNotificationsTest.php @@ -392,7 +392,7 @@ public function testSendLinkShareMailException($to, $cc, $bcc, $toList, $expecte } public function testSendInternalShareMail() { - $this->setupMailerMock('TestUser shared »<welcome>.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); + $this->setupMailerMock('TestUser shared ».txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); /** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */ $mailNotifications = $this->getMockBuilder('OC\Share\MailNotifications') @@ -441,7 +441,7 @@ public function testSendInternalShareMail() { } public function testSendInternalShareMailException() { - $this->setupMailerMock('TestUser shared »<welcome>.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); + $this->setupMailerMock('TestUser shared ».txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); /** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */ $mailNotifications = $this->getMockBuilder('OC\Share\MailNotifications')