diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-01-06 22:40:35 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-01-06 22:40:35 +0100 |
commit | bae175518427de1f43ac23dbc1e06a15f6933370 (patch) | |
tree | 90cdee24789526b1b6da16eda90e2c1547a66e62 /apps/files/js/files.js | |
parent | 39d874cd902a4e3d4f7ae313ec5e15bafe35df13 (diff) | |
parent | 08d7b8ce309baebfc243727c215b63e732bf874e (diff) | |
download | nextcloud-server-bae175518427de1f43ac23dbc1e06a15f6933370.tar.gz nextcloud-server-bae175518427de1f43ac23dbc1e06a15f6933370.zip |
Merge branch 'master' into fixing-784-master
Conflicts:
apps/files/ajax/upload.php
apps/files/js/files.js
lib/helper.php
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index e35dbe673d9..8d4cd06326e 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -43,17 +43,29 @@ Files={ } }, - 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() { @@ -530,7 +542,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')); |