summaryrefslogtreecommitdiffstats
path: root/lib/private/files.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-02-21 15:33:12 +0100
committerRobin Appelman <icewind@owncloud.com>2014-02-21 15:33:12 +0100
commit3980a7d9c6a20e7c0c9b92342e59e2a7ec443667 (patch)
treefa09b8f5a1a3d5695ce1278122d05fea7a1c8407 /lib/private/files.php
parent1331de554c0ab619df1826424e502803535481e2 (diff)
parentaa0bcf7ba45d004b0c0226fd07696f9f224f9c1c (diff)
downloadnextcloud-server-3980a7d9c6a20e7c0c9b92342e59e2a7ec443667.tar.gz
nextcloud-server-3980a7d9c6a20e7c0c9b92342e59e2a7ec443667.zip
Merge branch 'master' into folderid-reuse
Diffstat (limited to 'lib/private/files.php')
-rw-r--r--lib/private/files.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/files.php b/lib/private/files.php
index 4a6b9d8ca0e..656d6f044ca 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -32,6 +32,9 @@ class OC_Files {
return \OC\Files\Filesystem::getFileInfo($path, $includeMountPoints);
}
+ /**
+ * @param string $path
+ */
static public function getDirectoryContent($path){
return \OC\Files\Filesystem::getDirectoryContent($path);
}
@@ -103,7 +106,12 @@ class OC_Files {
if ($xsendfile) {
$filename = OC_Helper::moveToNoClean($filename);
}
- $name = $files . '.zip';
+ // downloading root ?
+ if ($files === '') {
+ $name = 'download.zip';
+ } else {
+ $name = $files . '.zip';
+ }
set_time_limit($executionTime);
} else {
$zip = false;
@@ -205,6 +213,8 @@ class OC_Files {
$dirname=basename($dir);
$zip->addEmptyDir($internalDir.$dirname);
$internalDir.=$dirname.='/';
+ // prevent absolute dirs
+ $internalDir = ltrim($internalDir, '/');
$files=OC_Files::getDirectoryContent($dir);
foreach($files as $file) {
$filename=$file['name'];