[Pkg-owncloud-commits] [owncloud] 101/129: Verify the src exists in webdav MOVE
David Prévot
taffit at moszumanska.debian.org
Thu Nov 5 01:04:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 997c307251d89045bfb7133af96af5ea1fb44619
Author: Roeland Jago Douma <rullzer at owncloud.com>
Date: Tue Oct 27 09:14:28 2015 +0100
Verify the src exists in webdav MOVE
* Unit test added
---
lib/private/connector/sabre/filesplugin.php | 4 ++++
tests/lib/connector/sabre/filesplugin.php | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php
index 38a7139..7363677 100644
--- a/lib/private/connector/sabre/filesplugin.php
+++ b/lib/private/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/tests/lib/connector/sabre/filesplugin.php b/tests/lib/connector/sabre/filesplugin.php
index 391062d..97eef14 100644
--- a/tests/lib/connector/sabre/filesplugin.php
+++ b/tests/lib/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');
+ }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list