[Pkg-owncloud-commits] [owncloud] 143/165: Do not trash part files, delete directly

David Prévot taffit at moszumanska.debian.org
Thu Apr 23 04:06:54 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 ffc796edcb02f9428ecd706ff4af4c5583928f2b
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Tue Apr 21 18:28:15 2015 +0200

    Do not trash part files, delete directly
---
 apps/files_trashbin/lib/storage.php  | 5 ++++-
 lib/private/connector/sabre/file.php | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/apps/files_trashbin/lib/storage.php b/apps/files_trashbin/lib/storage.php
index 61e0816..418d7d2 100644
--- a/apps/files_trashbin/lib/storage.php
+++ b/apps/files_trashbin/lib/storage.php
@@ -84,7 +84,10 @@ class Storage extends Wrapper {
 	 * @param string $path
 	 */
 	public function unlink($path) {
-		if (self::$disableTrash || !\OC_App::isEnabled('files_trashbin')) {
+		if (self::$disableTrash
+			|| !\OC_App::isEnabled('files_trashbin')
+			|| (pathinfo($path, PATHINFO_EXTENSION) === 'part')
+		) {
 			return $this->storage->unlink($path);
 		}
 		$normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index dc678c0..100aba1 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -117,7 +117,7 @@ class File extends Node implements IFile {
 			$target = $storage->fopen($internalPartPath, 'wb');
 			if ($target === false) {
 				\OC_Log::write('webdav', '\OC\Files\Filesystem::fopen() failed', \OC_Log::ERROR);
-				$this->fileView->unlink($partFilePath);
+				$storage->unlink($internalPartPath);
 				// because we have no clue about the cause we can only throw back a 500/Internal Server Error
 				throw new Exception('Could not write file contents');
 			}
@@ -166,7 +166,7 @@ class File extends Node implements IFile {
 					$fileExists = $storage->file_exists($internalPath);
 					if ($renameOkay === false || $fileExists === false) {
 						\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
-						$this->fileView->unlink($partFilePath);
+						$storage->unlink($internalPartPath);
 						throw new Exception('Could not rename part file to final file');
 					}
 				} catch (\OCP\Files\LockNotAcquiredException $e) {

-- 
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