fix download link for single files in publicly shared directory

This commit is contained in:
Björn Schießle 2012-10-05 13:25:28 +02:00
parent ee6d96b7a8
commit 99f4d949c1
1 changed files with 7 additions and 3 deletions

View File

@ -83,8 +83,12 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
// Download the file
if (isset($_GET['download'])) {
if (isset($_GET['dir'])) {
OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
} else {
if (isset($_GET['path']) && $_GET['path'] != '' ) { // download a file from a shared directory
OC_Files::get('', $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
} else { // download the whole shared directory
OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
}
} else { // download a single shared file
OC_Files::get("", $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
}
@ -108,7 +112,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
$i['basename'] = $fileinfo['filename'];
$i['extension'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : '';
}
$i['directory'] = substr($i['directory'], $rootLength);
$i['directory'] = '/'.substr('/'.$uidOwner.'/files'.$i['directory'], $rootLength);
if ($i['directory'] == '/') {
$i['directory'] = '';
}