]> source.dussan.org Git - nextcloud-server.git/commitdiff
Only move files from the current user to the trashbin
authorRobin Appelman <icewind@owncloud.com>
Fri, 23 Jan 2015 13:19:36 +0000 (14:19 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 23 Jan 2015 13:19:36 +0000 (14:19 +0100)
apps/files_trashbin/lib/storage.php

index 5036a260d0cce86a8f639277e05366d7e66077b0..f51d2a2fb702fbb44a6ae9a8e4f5d0e64e651a92 100644 (file)
@@ -23,6 +23,7 @@
 
 namespace OCA\Files_Trashbin;
 
+use OC\Files\Filesystem;
 use OC\Files\Storage\Wrapper\Wrapper;
 
 class Storage extends Wrapper {
@@ -38,13 +39,13 @@ class Storage extends Wrapper {
        }
 
        public function unlink($path) {
-               $normalized = \OC\Files\Filesystem::normalizePath($this->mountPoint . '/' . $path);
+               $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
                $result = true;
                if (!isset($this->deletedFiles[$normalized])) {
+                       $view = Filesystem::getView();
                        $this->deletedFiles[$normalized] = $normalized;
-                       $parts = explode('/', $normalized);
-                       if (count($parts) > 3 && $parts[2] === 'files') {
-                               $filesPath = implode('/', array_slice($parts, 3));
+                       if ($filesPath = $view->getRelativePath($normalized)) {
+                               $filesPath = trim($filesPath, '/');
                                $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath);
                                // in cross-storage cases the file will be copied
                                // but not deleted, so we delete it here