diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-09-22 16:36:23 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-09-22 16:36:23 +0200 |
commit | 828ae6568155bea825413226256a8a23b91a5462 (patch) | |
tree | a8d2ca57734240772579135e8c4540976910c5ba | |
parent | 70937dabcdf60a047000347523bfee7a53e673e6 (diff) | |
parent | 8aca127e52f965871bea82cb27c6ea103baf34bb (diff) | |
download | nextcloud-server-828ae6568155bea825413226256a8a23b91a5462.tar.gz nextcloud-server-828ae6568155bea825413226256a8a23b91a5462.zip |
Merge pull request #11186 from owncloud/trash-fixdoubledeleteracecondition
Added extra check to avoid deleting key folders
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 5f1226d89d8..ca7e58d93bd 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -142,6 +142,12 @@ class Trashbin { $user = \OCP\User::getUser(); $size = 0; list($owner, $ownerPath) = self::getUidAndFilename($file_path); + + // file has been deleted in between + if (empty($ownerPath)) { + return false; + } + self::setUpTrash($user); $view = new \OC\Files\View('/' . $user); @@ -219,6 +225,10 @@ class Trashbin { $rootView = new \OC\Files\View('/'); list($owner, $ownerPath) = self::getUidAndFilename($file_path); + // file has been deleted in between + if (empty($ownerPath)) { + return 0; + } if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) { $size += self::calculateSize(new \OC\Files\View('/' . $owner . '/files_versions/' . $ownerPath)); @@ -262,6 +272,11 @@ class Trashbin { list($owner, $ownerPath) = self::getUidAndFilename($file_path); + // file has been deleted in between + if (empty($ownerPath)) { + return 0; + } + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user); // disable proxy to prevent recursive calls @@ -440,6 +455,12 @@ class Trashbin { list($owner, $ownerPath) = self::getUidAndFilename($target); + // file has been deleted in between + if (empty($ownerPath)) { + \OC_FileProxy::$enabled = $proxyStatus; + return false; + } + if ($timestamp) { $versionedFile = $filename; } else { @@ -484,6 +505,11 @@ class Trashbin { list($owner, $ownerPath) = self::getUidAndFilename($target); + // file has been deleted in between + if (empty($ownerPath)) { + return false; + } + $util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user); if ($util->isSystemWideMountPoint($ownerPath)) { |