summaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-01-28 23:51:35 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-01-28 23:51:35 -0500
commitca4c006d5ab71acbd15ea011fba72eaddc34a901 (patch)
treed35950fe5c5b861835915bd22e0fe499b04949a2 /lib/files.php
parenta67f11c8afb78fc7ee011982257124f49910d269 (diff)
downloadnextcloud-server-ca4c006d5ab71acbd15ea011fba72eaddc34a901.tar.gz
nextcloud-server-ca4c006d5ab71acbd15ea011fba72eaddc34a901.zip
Make zip downloads use actual folder names, fix spelling mistakes
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/files.php b/lib/files.php
index 4d09946a23f..e3245653f99 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -37,10 +37,10 @@ class OC_Files {
}
/**
- * return the content of a file or return a zip file containning multiply files
+ * return the content of a file or return a zip file containing multiple files
*
* @param string $dir
- * @param string $file ; seperated list of files to download
+ * @param string $file ; separated list of files to download
* @param boolean $only_header ; boolean to only send header of the request
*/
public static function get($dir, $files, $only_header = false) {
@@ -77,6 +77,7 @@ class OC_Files {
}
}
$zip->close();
+ $name = basename($dir) . '.zip';
set_time_limit($executionTime);
} elseif (\OC\Files\Filesystem::is_dir($dir . '/' . $files)) {
self::validateZipDownload($dir, $files);
@@ -94,18 +95,20 @@ class OC_Files {
$file = $dir . '/' . $files;
self::zipAddDir($file, $zip);
$zip->close();
+ $name = $files . '.zip';
set_time_limit($executionTime);
} else {
$zip = false;
$filename = $dir . '/' . $files;
+ $name = $files;
}
OC_Util::obEnd();
if ($zip or \OC\Files\Filesystem::isReadable($filename)) {
if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
- header( 'Content-Disposition: attachment; filename="' . rawurlencode( basename($filename) ) . '"' );
+ header( 'Content-Disposition: attachment; filename="' . rawurlencode($name) . '"' );
} else {
- header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode( basename($filename) )
- . '; filename="' . rawurlencode( basename($filename) ) . '"' );
+ header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($name)
+ . '; filename="' . rawurlencode($name) . '"' );
}
header('Content-Transfer-Encoding: binary');
OC_Response::disableCaching();
@@ -125,7 +128,7 @@ class OC_Files {
} elseif ($zip or !\OC\Files\Filesystem::file_exists($filename)) {
header("HTTP/1.0 404 Not Found");
$tmpl = new OC_Template('', '404', 'guest');
- $tmpl->assign('file', $filename);
+ $tmpl->assign('file', $name);
$tmpl->printPage();
} else {
header("HTTP/1.0 403 Forbidden");