]> source.dussan.org Git - nextcloud-server.git/commitdiff
Proper exception for upload of .htaccess file via WebDAV 4705/head
authorMorris Jobke <hey@morrisjobke.de>
Thu, 4 May 2017 23:43:03 +0000 (20:43 -0300)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 9 May 2017 01:03:41 +0000 (20:03 -0500)
* fixes #2860

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
apps/files_versions/tests/VersioningTest.php
lib/private/Files/View.php

index a1649b2b600d048c5b5a3e1e6666054fa67ab087..4cd202113ddc350145fff688646776f03a2b14d3 100644 (file)
@@ -289,11 +289,11 @@ class VersioningTest extends \Test\TestCase {
 
                $this->runCommands();
 
-               $this->assertFalse($this->rootView->file_exists($v1));
-               $this->assertFalse($this->rootView->file_exists($v2));
+               $this->assertFalse($this->rootView->file_exists($v1), 'version 1 of old file does not exist');
+               $this->assertFalse($this->rootView->file_exists($v2), 'version 2 of old file does not exist');
 
-               $this->assertTrue($this->rootView->file_exists($v1Renamed));
-               $this->assertTrue($this->rootView->file_exists($v2Renamed));
+               $this->assertTrue($this->rootView->file_exists($v1Renamed), 'version 1 of renamed file exists');
+               $this->assertTrue($this->rootView->file_exists($v2Renamed), 'version 2 of renamed file exists');
        }
 
        public function testRenameInSharedFolder() {
@@ -337,11 +337,11 @@ class VersioningTest extends \Test\TestCase {
 
                self::loginHelper(self::TEST_VERSIONS_USER);
 
-               $this->assertFalse($this->rootView->file_exists($v1));
-               $this->assertFalse($this->rootView->file_exists($v2));
+               $this->assertFalse($this->rootView->file_exists($v1), 'version 1 of old file does not exist');
+               $this->assertFalse($this->rootView->file_exists($v2), 'version 2 of old file does not exist');
 
-               $this->assertTrue($this->rootView->file_exists($v1Renamed));
-               $this->assertTrue($this->rootView->file_exists($v2Renamed));
+               $this->assertTrue($this->rootView->file_exists($v1Renamed), 'version 1 of renamed file exists');
+               $this->assertTrue($this->rootView->file_exists($v2Renamed), 'version 2 of renamed file exists');
 
                \OC::$server->getShareManager()->deleteShare($share);
        }
@@ -553,11 +553,11 @@ class VersioningTest extends \Test\TestCase {
 
                $this->runCommands();
 
-               $this->assertTrue($this->rootView->file_exists($v1));
-               $this->assertTrue($this->rootView->file_exists($v2));
+               $this->assertTrue($this->rootView->file_exists($v1), 'version 1 of original file exists');
+               $this->assertTrue($this->rootView->file_exists($v2), 'version 2 of original file exists');
 
-               $this->assertTrue($this->rootView->file_exists($v1Copied));
-               $this->assertTrue($this->rootView->file_exists($v2Copied));
+               $this->assertTrue($this->rootView->file_exists($v1Copied), 'version 1 of copied file exists');
+               $this->assertTrue($this->rootView->file_exists($v2Copied), 'version 2 of copied file exists');
        }
 
        /**
index 5e581feba6e689ff7880b8dacab31d884e68823b..0e22415e6f735a6de31b0534b81946e330886f27 100644 (file)
@@ -1081,7 +1081,11 @@ class View {
         */
        public function free_space($path = '/') {
                $this->assertPathLength($path);
-               return $this->basicOperation('free_space', $path);
+               $result = $this->basicOperation('free_space', $path);
+               if ($result === null) {
+                       throw new InvalidPathException();
+               }
+               return $result;
        }
 
        /**