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.
remotes/origin/stable
Robin Appelman 14 years ago
parent 15d15104d4
commit 066ca70890
  1. 2
      files/api.php
  2. 22
      js/filebrowser.js
  3. 2
      js/lib_files.js

@ -54,7 +54,7 @@ if($arguments['action']){
break;
case 'getfiles':
$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;
echo json_encode($files);
break;

@ -130,12 +130,30 @@ OC_FILES.browser.files.show=function(parent,fileList){
}
}
//add the files that arent in the list yet
var unreadableFiles=[];
for(name in fileList){
file=fileList[name];
if(!OC_FILES.browser.files.fileNodes[file.name]){
OC_FILES.browser.files.add(file.name,file.type,file.size,file.date,file.mime);
if(file.readable){
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){

@ -47,7 +47,7 @@ OC_FILES.getdirectorycontent_parse=function(req){
for(var name in json){
if(name!='__max_upload'){
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){
var attributeName=attributes[i];
file[attributeName]=json[name][attributeName];

Loading…
Cancel
Save