summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/amazons3.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-01 14:57:43 +0200
committerRobin Appelman <icewind@owncloud.com>2014-09-17 15:51:57 +0200
commit3b08b3fad4729549a01679ca2c9e8d33234a58bf (patch)
tree630ae868ab9b87660801481603b8dc3c3a59ac72 /apps/files_external/lib/amazons3.php
parent6e12d830d581d62ef5abe66c3b53e8870eed132a (diff)
downloadnextcloud-server-3b08b3fad4729549a01679ca2c9e8d33234a58bf.tar.gz
nextcloud-server-3b08b3fad4729549a01679ca2c9e8d33234a58bf.zip
Fix amazon s3 rename overwrite
Diffstat (limited to 'apps/files_external/lib/amazons3.php')
-rw-r--r--apps/files_external/lib/amazons3.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 38e6371f5b9..d9e3ef05265 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -511,6 +511,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;
}
@@ -520,8 +526,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) {