Skip to content
Snippets Groups Projects
Commit c0e67fa2 authored by Robin Appelman's avatar Robin Appelman
Browse files

fix opening encrypted files from the browser

parent 70cb053e
Branches
No related tags found
No related merge requests found
...@@ -96,6 +96,7 @@ class OC_Files { ...@@ -96,6 +96,7 @@ class OC_Files {
$zip=false; $zip=false;
$filename=$dir.'/'.$files; $filename=$dir.'/'.$files;
} }
@ob_end_clean();
if($zip or OC_Filesystem::is_readable($filename)){ if($zip or OC_Filesystem::is_readable($filename)){
header('Content-Disposition: attachment; filename="'.basename($filename).'"'); header('Content-Disposition: attachment; filename="'.basename($filename).'"');
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
...@@ -106,7 +107,6 @@ class OC_Files { ...@@ -106,7 +107,6 @@ class OC_Files {
}else{ }else{
$fileData=OC_FileCache::get($filename); $fileData=OC_FileCache::get($filename);
header('Content-Type: ' . $fileData['mimetype']); header('Content-Type: ' . $fileData['mimetype']);
header('Content-Length: ' . $fileData['size']);
} }
}elseif($zip or !OC_Filesystem::file_exists($filename)){ }elseif($zip or !OC_Filesystem::file_exists($filename)){
header("HTTP/1.0 404 Not Found"); header("HTTP/1.0 404 Not Found");
...@@ -117,7 +117,6 @@ class OC_Files { ...@@ -117,7 +117,6 @@ class OC_Files {
header("HTTP/1.0 403 Forbidden"); header("HTTP/1.0 403 Forbidden");
die('403 Forbidden'); die('403 Forbidden');
} }
@ob_end_clean();
if($zip){ if($zip){
$handle=fopen($filename,'r'); $handle=fopen($filename,'r');
if ($handle) { if ($handle) {
......
...@@ -137,9 +137,9 @@ class OC_FilesystemView { ...@@ -137,9 +137,9 @@ class OC_FilesystemView {
} }
public function readfile($path){ public function readfile($path){
@ob_end_clean(); @ob_end_clean();
$handle=$this->fopen($path,'r'); $handle=$this->fopen($path,'rb');
if ($handle) { if ($handle) {
$chunkSize = 8*1024;// 1 MB chunks $chunkSize = 8192;// 8 MB chunks
while (!feof($handle)) { while (!feof($handle)) {
echo fread($handle, $chunkSize); echo fread($handle, $chunkSize);
flush(); flush();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment