diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 0b0633a338..ce71d0e81d 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -411,7 +411,10 @@ public function filteredDraft(string $filter, int $mailboxId, int $draftId): Tem */ public function compose(string $uri): RedirectResponse { $parts = parse_url($uri); - $params = ['to' => $parts['path']]; + $params = []; + if (isset($parts['path'])) { + $params['to'] = $parts['path']; + } if (isset($parts['query'])) { $parts = explode('&', $parts['query']); foreach ($parts as $part) { diff --git a/src/components/MailboxThread.vue b/src/components/MailboxThread.vue index 3fce095611..bf9a032b12 100644 --- a/src/components/MailboxThread.vue +++ b/src/components/MailboxThread.vue @@ -368,6 +368,7 @@ export default { accountId, to: this.stringToRecipients(this.$route.query.to), cc: this.stringToRecipients(this.$route.query.cc), + bcc: this.stringToRecipients(this.$route.query.bcc), subject: this.$route.query.subject || '', body: this.$route.query.body ? detect(this.$route.query.body) : html(''), }, diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php index d17ce67d57..5ea42fde9b 100644 --- a/tests/Unit/Controller/PageControllerTest.php +++ b/tests/Unit/Controller/PageControllerTest.php @@ -40,6 +40,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; +use function urlencode; class PageControllerTest extends TestCase { /** @var string */ @@ -380,6 +381,17 @@ public function testComposeWithCc() { $this->assertEquals($expected, $response); } + public function testComposeBcc() { + $bcc = 'blind@example.com'; + $uri = "mailto:?bcc=$bcc"; + + $expected = new RedirectResponse('?bcc=' . urlencode($bcc)); + + $response = $this->controller->compose($uri); + + $this->assertEquals($expected, $response); + } + public function testComposeWithBcc() { $address = 'user@example.com'; $bcc = 'blind@example.com';