From: Robin Appelman Date: Sat, 5 Jan 2013 02:30:05 +0000 (+0100) Subject: Files: prevent people from renaming files to '.' X-Git-Tag: v5.0.0alpha1~257^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a5dcbc3d8acfcf2845db281ef73df466508734c5;p=nextcloud-server.git Files: prevent people from renaming files to '.' --- diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php index 45448279fa1..cb0bec399d1 100644 --- a/apps/files/ajax/rename.php +++ b/apps/files/ajax/rename.php @@ -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{ diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 96dd0323d29..cc47ec2612e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -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) {