aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-06 18:05:13 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-06 18:05:13 +0100
commit8241cfa9c445d19f06f456c80a237c9c52bd2f11 (patch)
tree9ca134a5a52580bc694fac67edbd0cee84073428
parent469cf6001518b976808f82836bfd5863093cc639 (diff)
downloadnextcloud-server-8241cfa9c445d19f06f456c80a237c9c52bd2f11.tar.gz
nextcloud-server-8241cfa9c445d19f06f456c80a237c9c52bd2f11.zip
backport of #1092 to stable45
-rw-r--r--apps/files/ajax/rename.php2
-rw-r--r--apps/files/js/filelist.js8
-rw-r--r--apps/files/js/files.js16
3 files changed, 17 insertions, 9 deletions
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 5b0d61d7af9..a4cb3e615b7 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -147,13 +147,9 @@ var FileList={
event.stopPropagation();
event.preventDefault();
var newname=input.val();
- if (Files.containsInvalidCharacters(newname)) {
+ if (!Files.isFileNameValid(newname)) {
return false;
- } else if (newname.length == 0) {
- $('#notification').text(t('files', "Name cannot be empty."));
- $('#notification').fadeIn();
- return false;
- }
+ }
if (newname != name) {
if (FileList.checkName(name, newname, false)) {
newname = name;
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index c0d28209bbe..59b94f0d0db 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -26,7 +26,19 @@ Files={
});
procesSelection();
},
- containsInvalidCharacters:function (name) {
+ isFileNameValid:function (name) {
+ if (name === '.') {
+ $('#notification').text(t('files', "'.' is an invalid file name."));
+ $('#notification').fadeIn();
+ return false;
+ }
+ if (name.length == 0) {
+ $('#notification').text(t('files', "File name cannot be empty."));
+ $('#notification').fadeIn();
+ return false;
+ }
+
+ // check for invalid characters
var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
for (var i = 0; i < invalid_characters.length; i++) {
if (name.indexOf(invalid_characters[i]) != -1) {
@@ -527,7 +539,7 @@ $(document).ready(function() {
event.stopPropagation();
event.preventDefault();
var newname=input.val();
- if(type != 'web' && Files.containsInvalidCharacters(newname)){
+ if(type != 'web' && !Files.isFileNameValid(newname)){
return false;
} else if (newname.length == 0) {
if(type == 'web') {