summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-06 22:28:21 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-06 22:28:21 +0100
commit07b3b23a39d3592602efea3ab6448178fb1b166a (patch)
treeb02c933bc673b3e0e41e096d464cc9c27ad32167 /apps
parent7ebfcab49bf0ceac7f32a66f393ebdadc5d64a77 (diff)
parent08d7b8ce309baebfc243727c215b63e732bf874e (diff)
downloadnextcloud-server-07b3b23a39d3592602efea3ab6448178fb1b166a.tar.gz
nextcloud-server-07b3b23a39d3592602efea3ab6448178fb1b166a.zip
Merge branch 'master' into fixing-998-master
Conflicts: apps/files/js/files.js
Diffstat (limited to 'apps')
-rw-r--r--apps/files/ajax/rename.php2
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/js/files.js18
3 files changed, 16 insertions, 6 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 33f35eee6c5..fc37e03ba49 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.isFileNameValid(newname)) {
return false;
}
if (newname != name) {
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 6166b240e83..ac47f390826 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -26,16 +26,26 @@ Files={
});
procesSelection();
},
- containsInvalidCharacters:function (name) {
+ isFileNameValid:function (name) {
+ if (name === '.') {
+ OC.Notification.show(t('files', "'.' is an invalid file name."));
+ return false;
+ }
+ if (name.length == 0) {
+ OC.Notification.show(t('files', "File name cannot be empty."));
+ 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) {
OC.Notification.show(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
- return true;
+ return false;
}
}
OC.Notification.hide();
- return false;
+ return true;
},
displayStorageWarnings: function() {
var usedSpacePercent = $('#usedSpacePercent').val();
@@ -510,7 +520,7 @@ $(document).ready(function() {
$(this).append(input);
input.focus();
input.change(function(){
- if (type != 'web' && Files.containsInvalidCharacters($(this).val())) {
+ if (type != 'web' && !Files.isFileNameValid($(this).val())) {
return;
} else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') {
OC.Notification.show(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));