]> source.dussan.org Git - nextcloud-server.git/commitdiff
Files: prevent people from renaming files to '.'
authorRobin Appelman <icewind@owncloud.com>
Sat, 5 Jan 2013 02:30:05 +0000 (03:30 +0100)
committerRobin Appelman <icewind@owncloud.com>
Sat, 5 Jan 2013 02:30:05 +0000 (03:30 +0100)
apps/files/ajax/rename.php
apps/files/js/filelist.js

index 45448279fa161d46137c2bddee952060eaa6a584..cb0bec399d108fb094f0faccda8b897588d9a564 100644 (file)
@@ -12,7 +12,7 @@ $file = stripslashes($_GET["file"]);
 $newname = stripslashes($_GET["newname"]);
 
 // Delete
-if( OC_Files::move( $dir, $file, $dir, $newname )) {
+if( $newname !== '.' and OC_Files::move( $dir, $file, $dir, $newname )) {
        OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
 }
 else{
index 96dd0323d29a4b463ca96d2f6c789fc63a0deb91..cc47ec2612e1bc79d24776d6cde9c4fd4f899388 100644 (file)
@@ -149,7 +149,7 @@ var FileList={
                        event.stopPropagation();
                        event.preventDefault();
                        var newname=input.val();
-                       if (Files.containsInvalidCharacters(newname)) {
+                       if (Files.containsInvalidCharacters(newname) || newname === '.') {
                                return false;
                        }
                        if (newname != name) {