aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/js/files.js20
2 files changed, 17 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 1fbfc24e1e4..c4c53ca878a 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;
} else if (newname.length == 0) {
$('#notification').text(t('files', "Name cannot be empty."));
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index c795469e2d5..a824b9d3059 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -26,17 +26,29 @@ 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) {
$('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
$('#notification').fadeIn();
- return true;
+ return false;
}
}
$('#notification').fadeOut();
- return false;
+ return true;
}
};
$(document).ready(function() {
@@ -514,7 +526,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') {