diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-01-07 00:16:10 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-01-07 00:16:10 +0100 |
commit | e8d08d4930fae31a665c679b5ac1a147859eb099 (patch) | |
tree | 426671882f753d0fea8f80c786bdd6892d57cdb5 /apps/files/js | |
parent | 1137723b2a46c37d61e7f501694c73562b21ef74 (diff) | |
parent | 0b007235b99fa8d66cdb8ca917fe2f45dd8e4edc (diff) | |
download | nextcloud-server-e8d08d4930fae31a665c679b5ac1a147859eb099.tar.gz nextcloud-server-e8d08d4930fae31a665c679b5ac1a147859eb099.zip |
merge master into filesystem
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 2 | ||||
-rw-r--r-- | apps/files/js/files.js | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 96dd0323d29..22d701d8ff9 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 7fb451b9a09..37bbce00534 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() { @@ -509,7 +521,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') { $('#notification').text(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud')); |