[Pkg-owncloud-commits] [owncloud] 188/258: Fix amazon s3 rename overwrite

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 25d003a52d229c27bb41a32fa43fab978bded117
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Aug 1 14:57:43 2014 +0200

    Fix amazon s3 rename overwrite
---
 apps/files_external/lib/amazons3.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index af220f6..2e0819c 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -510,6 +510,12 @@ class AmazonS3 extends \OC\Files\Storage\Common {
 		$path2 = $this->normalizePath($path2);
 
 		if ($this->is_file($path1)) {
+			if ($this->is_dir($path2)) {
+				$this->rmdir($path2);
+			} else if ($this->file_exists($path2)) {
+				$this->unlink($path2);
+			}
+
 			if ($this->copy($path1, $path2) === false) {
 				return false;
 			}
@@ -519,8 +525,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
 				return false;
 			}
 		} else {
-			if ($this->file_exists($path2)) {
-				return false;
+			if ($this->is_dir($path2)) {
+				$this->rmdir($path2);
+			} else if ($this->file_exists($path2)) {
+				$this->unlink($path2);
 			}
 
 			if ($this->copy($path1, $path2) === false) {

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