event.stopPropagation();
event.preventDefault();
var newname=input.val();
- if (Files.containsInvalidCharacters(newname)) {
+ 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) {
if (FileList.checkName(name, newname, false)) {
var text=$(this).children('p').text();
$(this).data('text',text);
$(this).children('p').remove();
+ var form=$('<form></form>');
var input=$('<input>');
- $(this).append(input);
+ form.append(input);
+ $(this).append(form);
input.focus();
- input.change(function(){
- if (type != 'web' && !Files.isFileNameValid($(this).val())) {
- return;
- } else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') {
+ form.submit(function(event){
+ 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') {
+ $('#notification').text(t('files', "URL cannot be empty."));
+ } else {
+ $('#notification').text(t('files', "Name cannot be empty."));
+ }
+ $('#notification').fadeIn();
+ 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').fadeIn();
- return;
+ return false;
}
if (FileList.lastAction) {
FileList.lastAction();