Fix amazon s3 rename overwrite

This commit is contained in:
Robin Appelman 2014-08-01 14:57:43 +02:00
parent 6e12d830d5
commit 3b08b3fad4
1 changed files with 10 additions and 2 deletions

View File

@ -511,6 +511,12 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$path2 = $this->normalizePath($path2); $path2 = $this->normalizePath($path2);
if ($this->is_file($path1)) { 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) { if ($this->copy($path1, $path2) === false) {
return false; return false;
} }
@ -520,8 +526,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
return false; return false;
} }
} else { } else {
if ($this->file_exists($path2)) { if ($this->is_dir($path2)) {
return false; $this->rmdir($path2);
} else if ($this->file_exists($path2)) {
$this->unlink($path2);
} }
if ($this->copy($path1, $path2) === false) { if ($this->copy($path1, $path2) === false) {