[Pkg-owncloud-commits] [owncloud] 83/107: Fix thrashbin wrapper when no user is loggedin

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:39 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 b0842228f081b3b455be591c0e7c50cb81076565
Author: Robin Appelman <icewind at owncloud.com>
Date:   Tue Oct 27 12:10:23 2015 +0100

    Fix thrashbin wrapper when no user is loggedin
---
 apps/files_trashbin/lib/storage.php   |  5 +++--
 apps/files_trashbin/tests/storage.php | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/apps/files_trashbin/lib/storage.php b/apps/files_trashbin/lib/storage.php
index 0e42df1..becde5e 100644
--- a/apps/files_trashbin/lib/storage.php
+++ b/apps/files_trashbin/lib/storage.php
@@ -26,6 +26,7 @@ namespace OCA\Files_Trashbin;
 
 use OC\Files\Filesystem;
 use OC\Files\Storage\Wrapper\Wrapper;
+use OC\Files\View;
 use OCP\IUserManager;
 
 class Storage extends Wrapper {
@@ -151,8 +152,8 @@ class Storage extends Wrapper {
 
 		$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
 		$result = true;
-		if (!isset($this->deletedFiles[$normalized])) {
-			$view = Filesystem::getView();
+		$view = Filesystem::getView();
+		if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) {
 			$this->deletedFiles[$normalized] = $normalized;
 			if ($filesPath = $view->getRelativePath($normalized)) {
 				$filesPath = trim($filesPath, '/');
diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php
index 44b680f..67e5b29 100644
--- a/apps/files_trashbin/tests/storage.php
+++ b/apps/files_trashbin/tests/storage.php
@@ -524,4 +524,14 @@ class Storage extends \Test\TestCase {
 			['/schiesbn/', '/test.txt', false, false],
 		];
 	}
+
+	/**
+	 * Test that deleting a file doesn't error when nobody is logged in
+	 */
+	public function testSingleStorageDeleteFileLoggedOut() {
+		$this->logout();
+
+		$this->assertTrue($this->userView->file_exists('test.txt'));
+		$this->userView->unlink('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