summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/amazons3.php
diff options
context:
space:
mode:
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) {