fix downloading of files in files app

This commit is contained in:
Georg Ehrke 2012-04-26 17:35:12 +02:00
parent ebd82ee772
commit 0249a72cab
3 changed files with 7 additions and 6 deletions

View File

@ -135,7 +135,7 @@ $(document).ready(function(){
var downloadScope = 'file';
}
FileActions.register(downloadScope,'Download',function(){return OC.imagePath('core','actions/download')},function(filename){
window.location='ajax/download.php?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val());
window.location=OC.filePath('files', 'ajax', 'download.php?files='+encodeURIComponent(filename)+'&dir='+encodeURIComponent($('#dir').val()));
});
});

View File

@ -140,7 +140,7 @@ $(document).ready(function() {
var dir=$('#dir').val()||'/';
$('#notification').text(t('files','generating ZIP-file, it may take some time.'));
$('#notification').fadeIn();
window.location='ajax/download.php?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir);
window.location=OC.filePath('files', 'ajax', 'download.php?files='+encodeURIComponent(files)+'&dir='+encodeURIComponent(dir));
return false;
});
@ -418,7 +418,7 @@ var folderDropOptions={
var target=$(this).text().trim();
var dir=$('#dir').val();
$.ajax({
url: 'ajax/move.php',
url: OC.filePath('files', 'ajax', 'move.php'),
data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(dir)+'/'+encodeURIComponent(target),
complete: function(data){boolOperationFinished(data, function(){
var el = $('#fileList tr').filterAttr('data-file',file).find('td.filename');
@ -444,7 +444,7 @@ var crumbDropOptions={
return;
}
$.ajax({
url: 'ajax/move.php',
url: OC.filePath('files', 'ajax', 'move.php'),
data: "dir="+encodeURIComponent(dir)+"&file="+encodeURIComponent(file)+'&target='+encodeURIComponent(target),
complete: function(data){boolOperationFinished(data, function(){
FileList.remove(file);

View File

@ -53,12 +53,13 @@ OC={
filePath:function(app,type,file){
var isCore=OC.coreApps.indexOf(app)!=-1;
var link=OC.webroot;
if((file.substring(file.length-3) == 'php' || file.substring(file.length-3) == 'css') && !isCore){
var splitted = file.split('?');
if((splitted[0].substring(splitted[0].length-3) == 'php' || splitted[0].substring(splitted[0].length-3) == 'css') && !isCore){
link+='/?app=' + app + '&getfile=';
if(type){
link+=encodeURI(type + '/');
}
link+= file;
link+= file + '?' + splitted[1];
}else if(file.substring(file.length-3) != 'php' && !isCore){
link=OC.appswebroot;
link+='/';