From 30e086fb530c1c0d951fe58266cd5aed21fd91be Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Tue, 26 Nov 2013 16:32:44 +0100
Subject: [PATCH] Fixed SFTP storage to overwrite on rename

---
 apps/files_external/lib/sftp.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index bcc4c5eafd..95e0cefa39 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -285,6 +285,9 @@ class SFTP extends \OC\Files\Storage\Common {
 
 	public function rename($source, $target) {
 		try {
+			if (!$this->is_dir($target) && $this->file_exists($target)) {
+				$this->unlink($target);
+			}
 			return $this->client->rename(
 				$this->absPath($source),
 				$this->absPath($target)
-- 
GitLab