summaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2012-06-29 15:23:04 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2012-06-29 15:23:04 +0200
commitb95996c02c8b94a69eba21e31e0c5a3d30756d6d (patch)
tree7f197402a7ea7535deaf7292e1c958d660907509 /lib/files.php
parent60ec46f706fde158ec66b447446ed0b763e40076 (diff)
downloadnextcloud-server-b95996c02c8b94a69eba21e31e0c5a3d30756d6d.tar.gz
nextcloud-server-b95996c02c8b94a69eba21e31e0c5a3d30756d6d.zip
- when creating a new text file or directory which name already exist use the same pattern as for file uploads in such a case (add a (N) to the name)
- don't allow renaming if a file/directory with the name already exists
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/files.php b/lib/files.php
index 469c3a15b8e..cee273d95c9 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -167,10 +167,12 @@ class OC_Files {
* @param file $target
*/
public static function move($sourceDir,$source,$targetDir,$target){
- if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')){
+ if(OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared') && !OC_Filesystem::file_exists($tagetDir.'/'.$target)){
$targetFile=self::normalizePath($targetDir.'/'.$target);
$sourceFile=self::normalizePath($sourceDir.'/'.$source);
return OC_Filesystem::rename($sourceFile,$targetFile);
+ } else {
+ return false;
}
}