summaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-12-25 14:29:29 +0100
committerRobin Appelman <icewind@owncloud.com>2012-12-25 14:29:29 +0100
commit7e36f730ecfe452681f44771b28d1d3c4a5535df (patch)
tree578e604c170219151239e2da345d332b079ed920 /lib/files.php
parentbf05ff351faa693337107ed4a316e36e9aacd296 (diff)
parent5d59ac07391841677e204958ea20be3fe05cd8ef (diff)
downloadnextcloud-server-7e36f730ecfe452681f44771b28d1d3c4a5535df.tar.gz
nextcloud-server-7e36f730ecfe452681f44771b28d1d3c4a5535df.zip
merge master into filesystem
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/files.php b/lib/files.php
index 2d7e335e969..e12797bd610 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -100,8 +100,13 @@ class OC_Files {
$filename = $dir . '/' . $files;
}
OC_Util::obEnd();
- if ($zip or \OC\Files\Filesystem::isReadable($filename)) {
- header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
+ if($zip or \OC\Files\Filesystem::is_readable($filename)) {
+ if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
+ header( 'Content-Disposition: attachment; filename="' . rawurlencode( basename($filename) ) . '"' );
+ } else {
+ header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode( basename($filename) )
+ . '; filename="' . rawurlencode( basename($filename) ) . '"' );
+ }
header('Content-Transfer-Encoding: binary');
OC_Response::disableCaching();
if ($zip) {
@@ -111,7 +116,8 @@ class OC_Files {
self::addSendfileHeader($filename);
}else{
header('Content-Type: '.\OC\Files\Filesystem::getMimeType($filename));
- list($storage, ) = \OC\Files\Filesystem::resolvePath($filename);
+ header("Content-Length: ".\OC\Files\Filesystem::filesize($filename));
+ $storage = \OC\Files\Filesystem::getStorage($filename);
if ($storage instanceof \OC\File\Storage\Local) {
self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
}
@@ -125,10 +131,8 @@ class OC_Files {
header("HTTP/1.0 403 Forbidden");
die('403 Forbidden');
}
- if ($only_header) {
- if (!$zip)
- header("Content-Length: " . \OC\Files\Filesystem::filesize($filename));
- return;
+ if($only_header) {
+ return ;
}
if ($zip) {
$handle = fopen($filename, 'r');