adapt to isFileNameValid, whitespace cleanup
This commit is contained in:
parent
9671ace32e
commit
cbb118d4a3
|
@ -151,12 +151,7 @@ var FileList={
|
||||||
var newname=input.val();
|
var newname=input.val();
|
||||||
if (!Files.isFileNameValid(newname)) {
|
if (!Files.isFileNameValid(newname)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (newname.length == 0) {
|
} else if (newname != name) {
|
||||||
$('#notification').text(t('files', "Name cannot be empty."));
|
|
||||||
$('#notification').fadeIn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (newname != name) {
|
|
||||||
if (FileList.checkName(name, newname, false)) {
|
if (FileList.checkName(name, newname, false)) {
|
||||||
newname = name;
|
newname = name;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -26,19 +26,19 @@ Files={
|
||||||
});
|
});
|
||||||
procesSelection();
|
procesSelection();
|
||||||
},
|
},
|
||||||
isFileNameValid:function (name) {
|
isFileNameValid:function (name) {
|
||||||
if (name === '.') {
|
if (name === '.') {
|
||||||
$('#notification').text(t('files', "'.' is an invalid file name."));
|
$('#notification').text(t('files', '\'.\' is an invalid file name.'));
|
||||||
$('#notification').fadeIn();
|
$('#notification').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (name.length == 0) {
|
if (name.length == 0) {
|
||||||
$('#notification').text(t('files', "File name cannot be empty."));
|
$('#notification').text(t('files', 'File name cannot be empty.'));
|
||||||
$('#notification').fadeIn();
|
$('#notification').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for invalid characters
|
// check for invalid characters
|
||||||
var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
|
var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
|
||||||
for (var i = 0; i < invalid_characters.length; i++) {
|
for (var i = 0; i < invalid_characters.length; i++) {
|
||||||
if (name.indexOf(invalid_characters[i]) != -1) {
|
if (name.indexOf(invalid_characters[i]) != -1) {
|
||||||
|
@ -526,18 +526,14 @@ $(document).ready(function() {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var newname=input.val();
|
var newname=input.val();
|
||||||
if(type != 'web' && !Files.isFileNameValid(newname)){
|
if(type == 'web' && newname.length == 0) {
|
||||||
return false;
|
$('#notification').text(t('files', 'URL cannot be empty.'));
|
||||||
} 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();
|
$('#notification').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
|
} else if (type != 'web' && !Files.isFileNameValid(newname)) {
|
||||||
|
return false;
|
||||||
} else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') {
|
} 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();
|
$('#notification').fadeIn();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue