Merge pull request #11186 from owncloud/trash-fixdoubledeleteracecondition
Added extra check to avoid deleting key folders
This commit is contained in:
commit
828ae65681
|
@ -142,6 +142,12 @@ class Trashbin {
|
||||||
$user = \OCP\User::getUser();
|
$user = \OCP\User::getUser();
|
||||||
$size = 0;
|
$size = 0;
|
||||||
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
|
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
|
||||||
|
|
||||||
|
// file has been deleted in between
|
||||||
|
if (empty($ownerPath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
self::setUpTrash($user);
|
self::setUpTrash($user);
|
||||||
|
|
||||||
$view = new \OC\Files\View('/' . $user);
|
$view = new \OC\Files\View('/' . $user);
|
||||||
|
@ -219,6 +225,10 @@ class Trashbin {
|
||||||
$rootView = new \OC\Files\View('/');
|
$rootView = new \OC\Files\View('/');
|
||||||
|
|
||||||
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
|
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)) {
|
if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
|
||||||
$size += self::calculateSize(new \OC\Files\View('/' . $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);
|
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);
|
$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user);
|
||||||
|
|
||||||
// disable proxy to prevent recursive calls
|
// disable proxy to prevent recursive calls
|
||||||
|
@ -440,6 +455,12 @@ class Trashbin {
|
||||||
|
|
||||||
list($owner, $ownerPath) = self::getUidAndFilename($target);
|
list($owner, $ownerPath) = self::getUidAndFilename($target);
|
||||||
|
|
||||||
|
// file has been deleted in between
|
||||||
|
if (empty($ownerPath)) {
|
||||||
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($timestamp) {
|
if ($timestamp) {
|
||||||
$versionedFile = $filename;
|
$versionedFile = $filename;
|
||||||
} else {
|
} else {
|
||||||
|
@ -484,6 +505,11 @@ class Trashbin {
|
||||||
|
|
||||||
list($owner, $ownerPath) = self::getUidAndFilename($target);
|
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);
|
$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), $user);
|
||||||
|
|
||||||
if ($util->isSystemWideMountPoint($ownerPath)) {
|
if ($util->isSystemWideMountPoint($ownerPath)) {
|
||||||
|
|
Loading…
Reference in New Issue