Merge pull request #5387 from nextcloud/backport-5367

[stable12] Fix unknown share token error message
This commit is contained in:
Morris Jobke 2017-06-13 17:23:29 -05:00 committed by GitHub
commit 9f265007fe
2 changed files with 7 additions and 2 deletions

View 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'));
}
}

View 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();