Merge pull request #22309 from owncloud/infinite-recursion-on-expired-link

Do not getShare in deleteShare, it's already there when deleting
This commit is contained in:
Thomas Müller 2016-02-12 11:11:26 +01:00
commit 207c09c511
2 changed files with 4 additions and 14 deletions

View File

@ -718,9 +718,9 @@ class Manager implements IManager {
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function deleteShare(\OCP\Share\IShare $share) { public function deleteShare(\OCP\Share\IShare $share) {
// Just to make sure we have all the info
try { try {
$share = $this->getShareById($share->getFullId()); $share->getFullId();
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
throw new \InvalidArgumentException('Share does not have a full id'); throw new \InvalidArgumentException('Share does not have a full id');
} }

View File

@ -132,16 +132,10 @@ class ManagerTest extends \Test\TestCase {
} }
/** /**
* @expectedException \OCP\Share\Exceptions\ShareNotFound * @expectedException \InvalidArgumentException
*/ */
public function testDeleteNoShareId() { public function testDeleteNoShareId() {
$share = $this->getMock('\OCP\Share\IShare'); $share = $this->manager->newShare();
$share
->expects($this->once())
->method('getFullId')
->with()
->willReturn(null);
$this->manager->deleteShare($share); $this->manager->deleteShare($share);
} }
@ -181,7 +175,6 @@ class ManagerTest extends \Test\TestCase {
->setNode($path) ->setNode($path)
->setTarget('myTarget'); ->setTarget('myTarget');
$manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share);
$manager->expects($this->once())->method('deleteChildren')->with($share); $manager->expects($this->once())->method('deleteChildren')->with($share);
$this->defaultProvider $this->defaultProvider
@ -261,7 +254,6 @@ class ManagerTest extends \Test\TestCase {
$this->rootFolder->expects($this->never())->method($this->anything()); $this->rootFolder->expects($this->never())->method($this->anything());
$manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share);
$manager->expects($this->once())->method('deleteChildren')->with($share); $manager->expects($this->once())->method('deleteChildren')->with($share);
$this->defaultProvider $this->defaultProvider
@ -359,8 +351,6 @@ class ManagerTest extends \Test\TestCase {
->setTarget('myTarget3') ->setTarget('myTarget3')
->setParent(43); ->setParent(43);
$manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share1);
$this->defaultProvider $this->defaultProvider
->method('getChildren') ->method('getChildren')
->will($this->returnValueMap([ ->will($this->returnValueMap([