diff --git a/apps/dav/lib/connector/sabre/filesplugin.php b/apps/dav/lib/connector/sabre/filesplugin.php index c9fc78a795f14ecc9e7d9c86cf4d52cf4f6e6293..61b5360cac1312ceae1b70d787bf0322ce90185b 100644 --- a/apps/dav/lib/connector/sabre/filesplugin.php +++ b/apps/dav/lib/connector/sabre/filesplugin.php @@ -132,6 +132,10 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { if ($sourceDir !== $destinationDir) { $sourceFileInfo = $this->fileView->getFileInfo($source); + if ($sourceFileInfo === false) { + throw new \Sabre\DAV\Exception\NotFound($source . ' does not exist'); + } + if (!$sourceFileInfo->isDeletable()) { throw new \Sabre\DAV\Exception\Forbidden($source . " cannot be deleted"); } diff --git a/apps/dav/tests/unit/connector/sabre/filesplugin.php b/apps/dav/tests/unit/connector/sabre/filesplugin.php index a91ca7a4ff78e34b479d6e809a4bf9a5f9166637..db3bbabefd0a2c5928e90219a8528f4f0d2936f6 100644 --- a/apps/dav/tests/unit/connector/sabre/filesplugin.php +++ b/apps/dav/tests/unit/connector/sabre/filesplugin.php @@ -251,4 +251,17 @@ class FilesPlugin extends \Test\TestCase { $this->plugin->checkMove('FolderA/test.txt', 'test.txt'); } + + /** + * @expectedException \Sabre\DAV\Exception\NotFound + * @expectedExceptionMessage FolderA/test.txt does not exist + */ + public function testMoveSrcNotExist() { + $this->view->expects($this->once()) + ->method('getFileInfo') + ->with('FolderA/test.txt') + ->willReturn(false); + + $this->plugin->checkMove('FolderA/test.txt', 'test.txt'); + } }