diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php index f71651e71f..afecff0b97 100644 --- a/lib/private/Share/MailNotifications.php +++ b/lib/private/Share/MailNotifications.php @@ -119,27 +119,9 @@ class MailNotifications { } } - // Link to folder, or root folder if a file - - if ($itemType === 'folder') { - $args = array( - 'dir' => $filename, - ); - } else if (strpos($filename, '/')) { - $args = array( - 'dir' => '/' . dirname($filename), - 'scrollto' => basename($filename), - ); - } else { - $args = array( - 'dir' => '/', - 'scrollto' => $filename, - ); - } - $link = $this->urlGenerator->linkToRouteAbsolute( - 'files.view.index', - $args + 'files.viewcontroller.showFile', + ['fileId' => $items[0]['item_source']] ); list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration, 'internal'); diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php index 8c8ca78f39..f160fed57a 100644 --- a/tests/lib/share/MailNotificationsTest.php +++ b/tests/lib/share/MailNotificationsTest.php @@ -222,7 +222,7 @@ class MailNotificationsTest extends \Test\TestCase { $mailNotifications->method('getItemSharedWithUser') ->withAnyParameters() ->willReturn([ - ['file_target' => '/welcome.txt'] + ['file_target' => '/welcome.txt', 'item_source' => 123], ]); $recipient = $this->getMockBuilder('\OCP\IUser') @@ -239,10 +239,9 @@ class MailNotificationsTest extends \Test\TestCase { $this->urlGenerator->expects($this->once()) ->method('linkToRouteAbsolute') ->with( - $this->equalTo('files.view.index'), + $this->equalTo('files.viewcontroller.showFile'), $this->equalTo([ - 'dir' => '/', - 'scrollto' => 'welcome.txt' + 'fileId' => 123, ]) );