summaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js20
1 files changed, 16 insertions, 4 deletions
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') {