summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2012-10-05 13:25:28 +0200
committerBjörn Schießle <schiessle@owncloud.com>2012-10-05 14:28:23 +0200
commit99f4d949c1b4fb8d7442afc89348bd18fb601df3 (patch)
treeab0fb2fb52a9758bef6416b129cddd66a4b6a9c9 /apps
parentee6d96b7a8a7d179a66e49e0606ff024fdf105db (diff)
downloadnextcloud-server-99f4d949c1b4fb8d7442afc89348bd18fb601df3.tar.gz
nextcloud-server-99f4d949c1b4fb8d7442afc89348bd18fb601df3.zip
fix download link for single files in publicly shared directory
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/public.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 6aab650aa7f..13a328ff74c 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -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'] = '';
}