Skip to content
Snippets Groups Projects
Commit 415cf927 authored by Robin Appelman's avatar Robin Appelman
Browse files

Fix thrashbin wrapper when no user is loggedin

parent 4f860b7e
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ namespace OCA\Files_Trashbin; ...@@ -26,6 +26,7 @@ namespace OCA\Files_Trashbin;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OC\Files\Storage\Wrapper\Wrapper; use OC\Files\Storage\Wrapper\Wrapper;
use OC\Files\View;
use OCP\IUserManager; use OCP\IUserManager;
class Storage extends Wrapper { class Storage extends Wrapper {
...@@ -151,8 +152,8 @@ class Storage extends Wrapper { ...@@ -151,8 +152,8 @@ class Storage extends Wrapper {
$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
$result = true; $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; $this->deletedFiles[$normalized] = $normalized;
if ($filesPath = $view->getRelativePath($normalized)) { if ($filesPath = $view->getRelativePath($normalized)) {
$filesPath = trim($filesPath, '/'); $filesPath = trim($filesPath, '/');
......
...@@ -531,4 +531,14 @@ class Storage extends \Test\TestCase { ...@@ -531,4 +531,14 @@ class Storage extends \Test\TestCase {
['/schiesbn/', '/test.txt', false, false], ['/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');
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment