only show files in the filebrowser that we can actually read.
in the (rare) case that there are unreadable files show an error since it's probably a case of incorrect premissions set by someone.
This commit is contained in:
parent
15d15104d4
commit
066ca70890
|
@ -54,7 +54,7 @@ if($arguments['action']){
|
||||||
break;
|
break;
|
||||||
case 'getfiles':
|
case 'getfiles':
|
||||||
$max_upload=min(return_bytes(ini_get('post_max_size')),return_bytes(ini_get('upload_max_filesize')));
|
$max_upload=min(return_bytes(ini_get('post_max_size')),return_bytes(ini_get('upload_max_filesize')));
|
||||||
$files=OC_FILES::getdirectorycontent($arguments['dir']);
|
$files=OC_FILES::getDirectoryContent($arguments['dir']);
|
||||||
$files['__max_upload']=$max_upload;
|
$files['__max_upload']=$max_upload;
|
||||||
echo json_encode($files);
|
echo json_encode($files);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -130,12 +130,30 @@ OC_FILES.browser.files.show=function(parent,fileList){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//add the files that arent in the list yet
|
//add the files that arent in the list yet
|
||||||
|
var unreadableFiles=[];
|
||||||
for(name in fileList){
|
for(name in fileList){
|
||||||
file=fileList[name];
|
file=fileList[name];
|
||||||
if(!OC_FILES.browser.files.fileNodes[file.name]){
|
if(file.readable){
|
||||||
OC_FILES.browser.files.add(file.name,file.type,file.size,file.date,file.mime);
|
if(!OC_FILES.browser.files.fileNodes[file.name]){
|
||||||
|
OC_FILES.browser.files.add(file.name,file.type,file.size,file.date,file.mime);
|
||||||
|
}
|
||||||
|
}else if(file.name){
|
||||||
|
unreadableFiles.push(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(unreadableFiles.length>0){
|
||||||
|
var message=unreadableFiles.length+" unreadable files detected:\n";
|
||||||
|
var first=true;
|
||||||
|
unreadableFiles.foreach(function(item){
|
||||||
|
if(!first){
|
||||||
|
message+=', ';
|
||||||
|
}
|
||||||
|
first=false;
|
||||||
|
message+=item.name;
|
||||||
|
});
|
||||||
|
message+="\nPlease check the file premissions";
|
||||||
|
alert(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OC_FILES.browser.files.add=function(name,type,size,date,mime){
|
OC_FILES.browser.files.add=function(name,type,size,date,mime){
|
||||||
|
|
|
@ -47,7 +47,7 @@ OC_FILES.getdirectorycontent_parse=function(req){
|
||||||
for(var name in json){
|
for(var name in json){
|
||||||
if(name!='__max_upload'){
|
if(name!='__max_upload'){
|
||||||
var file=new Array();
|
var file=new Array();
|
||||||
var attributes=Array('size','name','type','directory','date','mime');
|
var attributes=Array('size','name','type','directory','date','mime','writable','readable');
|
||||||
for(var i in attributes){
|
for(var i in attributes){
|
||||||
var attributeName=attributes[i];
|
var attributeName=attributes[i];
|
||||||
file[attributeName]=json[name][attributeName];
|
file[attributeName]=json[name][attributeName];
|
||||||
|
|
Loading…
Reference in New Issue