From 4fd0514f0af9286636c3665d02d10700fd0e3141 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 28 Oct 2012 15:20:20 +0100 Subject: [PATCH] don't move file into subdirectory if a file with the same name already exists (fixes #92) --- apps/files/ajax/move.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php index ddcda553e3..db8f59b43d 100644 --- a/apps/files/ajax/move.php +++ b/apps/files/ajax/move.php @@ -12,6 +12,11 @@ $file = stripslashes($_GET["file"]); $target = stripslashes(urldecode($_GET["target"])); +if(OC_Filesystem::file_exists($target . '/' . $file)){ + OCP\JSON::error(array("data" => array( "message" => "Could not move $file - File with this name already exists" ))); + exit; +} + if(OC_Files::move($dir, $file, $target, $file)) { OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); } else {