]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix unknown share token 5387/head
authorJoas Schilling <coding@schilljs.com>
Tue, 13 Jun 2017 16:44:14 +0000 (18:44 +0200)
committerJoas Schilling <coding@schilljs.com>
Tue, 13 Jun 2017 16:53:52 +0000 (18:53 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Share20/Manager.php
tests/lib/Share20/ManagerTest.php

index 06d03f2ec7cf9cb2a797c5111835d596e4654c77..57ba39d41f6e83365ac5f6be888431e875421826 100644 (file)
@@ -1090,7 +1090,7 @@ class Manager implements IManager {
                }
 
                if ($share === null) {
-                       throw new ShareNotFound();
+                       throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
                }
 
                $this->checkExpireDate($share);
@@ -1110,7 +1110,7 @@ class Manager implements IManager {
                if ($share->getExpirationDate() !== null &&
                        $share->getExpirationDate() <= new \DateTime()) {
                        $this->deleteShare($share);
-                       throw new ShareNotFound();
+                       throw new ShareNotFound($this->l->t('The requested share does not exist anymore'));
                }
 
        }
index 13556285b617b78339ab4aa6f6a6a91004cab2ba..79af2f60ce86373dbc2df31704b67b843a613272 100644 (file)
@@ -2142,6 +2142,7 @@ class ManagerTest extends \Test\TestCase {
 
        /**
         * @expectedException \OCP\Share\Exceptions\ShareNotFound
+        * @expectedExceptionMessage The requested share does not exist anymore
         */
        public function testGetShareByTokenExpired() {
                $this->config
@@ -2150,6 +2151,10 @@ class ManagerTest extends \Test\TestCase {
                        ->with('core', 'shareapi_allow_links', 'yes')
                        ->willReturn('yes');
 
+               $this->l->expects($this->once())
+                       ->method('t')
+                       ->willReturnArgument(0);
+
                $manager = $this->createManagerMock()
                        ->setMethods(['deleteShare'])
                        ->getMock();