Files: prevent people from renaming files to '.'

This commit is contained in:
Robin Appelman 2013-01-05 03:30:05 +01:00
parent 0b13b41189
commit a5dcbc3d8a
2 changed files with 2 additions and 2 deletions

View 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{

View 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) {