diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-07 10:39:35 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-07 10:39:35 +0100 |
commit | cbb118d4a3a26c9471ffc40cc387df4333031da1 (patch) | |
tree | 2248dc7bc553ccd43409ae49a9654dc6fde3438e | |
parent | 9671ace32e57ce6b176a50dc346baf3b3b7eb14e (diff) | |
download | nextcloud-server-cbb118d4a3a26c9471ffc40cc387df4333031da1.tar.gz nextcloud-server-cbb118d4a3a26c9471ffc40cc387df4333031da1.zip |
adapt to isFileNameValid, whitespace cleanup
-rw-r--r-- | apps/files/js/filelist.js | 7 | ||||
-rw-r--r-- | apps/files/js/files.js | 40 |
2 files changed, 19 insertions, 28 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index c4c53ca878a..66697bbbf56 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -151,12 +151,7 @@ var FileList={ var newname=input.val(); 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) { + } else if (newname != name) { if (FileList.checkName(name, newname, false)) { newname = name; } else { diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a824b9d3059..91204f041e5 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -26,19 +26,19 @@ Files={ }); procesSelection(); }, - 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 + 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) { @@ -526,18 +526,14 @@ $(document).ready(function() { event.stopPropagation(); event.preventDefault(); var newname=input.val(); - if(type != 'web' && !Files.isFileNameValid(newname)){ - return false; - } else if (newname.length == 0) { - if(type == 'web') { - $('#notification').text(t('files', "URL cannot be empty.")); - } else { - $('#notification').text(t('files', "Name cannot be empty.")); - } + if(type == 'web' && newname.length == 0) { + $('#notification').text(t('files', 'URL cannot be empty.')); $('#notification').fadeIn(); return false; + } else if (type != 'web' && !Files.isFileNameValid(newname)) { + return false; } else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') { - $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud')); + $('#notification').text(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud')); $('#notification').fadeIn(); return false; } |