aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/ajax/move.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/ajax/move.php')
-rw-r--r--apps/files/ajax/move.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
index 8b3149ef14e..f8727831228 100644
--- a/apps/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -11,9 +11,14 @@ $dir = stripslashes($_GET["dir"]);
$file = stripslashes($_GET["file"]);
$target = stripslashes($_GET["target"]);
-
-if(OC_Files::move($dir, $file, $target, $file)) {
- OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
-} else {
+if (OC_User::isLoggedIn() && ($dir != '' || $file != 'Shared')) {
+ $targetFile = \OC\Files\Filesystem::normalizePath($dir . '/' . $file);
+ $sourceFile = \OC\Files\Filesystem::normalizePath($target . '/' . $file);
+ if(\OC\Files\Filesystem::rename($sourceFile, $targetFile)) {
+ OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
+ } else {
+ OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
+ }
+}else{
OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
}