diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-23 03:05:52 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-23 03:05:52 -0800 |
commit | b5b7a67f8a56fb866fe8690ce7573231ea29b989 (patch) | |
tree | c57f5540aee639defceea63a97e0bacd3008cfc9 | |
parent | 97ed467224b77dff4d30a88707eb30e6a7728f25 (diff) | |
parent | a81d7cd79ff78122521dc0c8db864a9654710863 (diff) | |
download | nextcloud-server-b5b7a67f8a56fb866fe8690ce7573231ea29b989.tar.gz nextcloud-server-b5b7a67f8a56fb866fe8690ce7573231ea29b989.zip |
Merge pull request #480 from owncloud/fix_435_and_437
Also reject names with \ in the name
-rw-r--r-- | apps/files/js/filelist.js | 3 | ||||
-rw-r--r-- | apps/files/js/files.js | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a5550dc9926..5674206632b 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -151,6 +151,9 @@ var FileList={ event.stopPropagation(); event.preventDefault(); var newname=input.val(); + if (Files.containsInvalidCharacters(newname)) { + return false; + } if (newname != name) { if (FileList.checkName(name, newname, false)) { newname = name; diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 2b250e0c7c5..28d4b49670d 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -25,6 +25,18 @@ Files={ delete uploadingFiles[index]; }); procesSelection(); + }, + containsInvalidCharacters:function (name) { + 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; + } + } + $('#notification').fadeOut(); + return false; } }; $(document).ready(function() { @@ -505,9 +517,7 @@ $(document).ready(function() { $(this).append(input); input.focus(); input.change(function(){ - if(type != 'web' && $(this).val().indexOf('/')!=-1){ - $('#notification').text(t('files','Invalid name, \'/\' is not allowed.')); - $('#notification').fadeIn(); + if (type != 'web' && Files.containsInvalidCharacters($(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')); |