introduce Files.containsInvalidCharacters(), use when creating or renaming files
Conflicts: apps/files/js/files.js
This commit is contained in:
parent
3c5470358e
commit
f385d32331
|
@ -147,6 +147,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;
|
||||
|
|
|
@ -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() {
|
||||
|
@ -510,15 +522,8 @@ $(document).ready(function() {
|
|||
$(this).append(input);
|
||||
input.focus();
|
||||
input.change(function(){
|
||||
if (type != 'web') {
|
||||
var invalid_characters = ['\\', '/', '<', '>', ':', '"', '|', '?', '*'];
|
||||
for (var i = 0; i < invalid_characters.length; i++) {
|
||||
if ($(this).val().indexOf(invalid_characters[i]) != -1) {
|
||||
$('#notification').text(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are 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'));
|
||||
$('#notification').fadeIn();
|
||||
|
|
Loading…
Reference in New Issue