mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge branch 'master' into fixing-998-master
Conflicts: apps/files/js/files.js
This commit is contained in:
commit
07b3b23a39
3 changed files with 16 additions and 6 deletions
|
|
@ -12,7 +12,7 @@ $file = stripslashes($_GET["file"]);
|
|||
$newname = stripslashes($_GET["newname"]);
|
||||
|
||||
// Delete
|
||||
if( OC_Files::move( $dir, $file, $dir, $newname )) {
|
||||
if( $newname !== '.' and OC_Files::move( $dir, $file, $dir, $newname )) {
|
||||
OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ var FileList={
|
|||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
var newname=input.val();
|
||||
if (Files.containsInvalidCharacters(newname)) {
|
||||
if (!Files.isFileNameValid(newname)) {
|
||||
return false;
|
||||
}
|
||||
if (newname != name) {
|
||||
|
|
|
|||
|
|
@ -26,16 +26,26 @@ Files={
|
|||
});
|
||||
procesSelection();
|
||||
},
|
||||
containsInvalidCharacters:function (name) {
|
||||
isFileNameValid:function (name) {
|
||||
if (name === '.') {
|
||||
OC.Notification.show(t('files', "'.' is an invalid file name."));
|
||||
return false;
|
||||
}
|
||||
if (name.length == 0) {
|
||||
OC.Notification.show(t('files', "File name cannot be empty."));
|
||||
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) {
|
||||
OC.Notification.show(t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed."));
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
OC.Notification.hide();
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
displayStorageWarnings: function() {
|
||||
var usedSpacePercent = $('#usedSpacePercent').val();
|
||||
|
|
@ -510,7 +520,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') {
|
||||
OC.Notification.show(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue