]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix opening encrypted files from the browser
authorRobin Appelman <icewind@owncloud.com>
Sat, 5 May 2012 14:49:22 +0000 (16:49 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 5 May 2012 14:49:48 +0000 (16:49 +0200)
lib/files.php
lib/filesystemview.php

index 107605fc34e4c45787c7e1296695fbe99734c621..5d4d73630eb8d016af7ff33ad9cc50017c87b9e5 100644 (file)
@@ -96,6 +96,7 @@ class OC_Files {
                        $zip=false;
                        $filename=$dir.'/'.$files;
                }
+               @ob_end_clean();
                if($zip or OC_Filesystem::is_readable($filename)){
                        header('Content-Disposition: attachment; filename="'.basename($filename).'"');
                        header('Content-Transfer-Encoding: binary');
@@ -106,7 +107,6 @@ class OC_Files {
                        }else{
                                $fileData=OC_FileCache::get($filename);
                                header('Content-Type: ' . $fileData['mimetype']);
-                               header('Content-Length: ' . $fileData['size']);
                        }
                }elseif($zip or !OC_Filesystem::file_exists($filename)){
                        header("HTTP/1.0 404 Not Found");
@@ -117,7 +117,6 @@ class OC_Files {
                        header("HTTP/1.0 403 Forbidden");
                        die('403 Forbidden');
                }
-               @ob_end_clean();
                if($zip){
                        $handle=fopen($filename,'r');
                        if ($handle) {
index ac5a0a3bff50bc81d6039dd614033a4fae05b8bd..b62bb82c699a5907f19e500e66e114042687d891 100644 (file)
@@ -137,9 +137,9 @@ class OC_FilesystemView {
        }
        public function readfile($path){
                @ob_end_clean();
-               $handle=$this->fopen($path,'r');
+               $handle=$this->fopen($path,'rb');
                if ($handle) {
-                       $chunkSize = 8*1024;// 1 MB chunks
+                       $chunkSize = 8192;// 8 MB chunks
                        while (!feof($handle)) {
                                echo fread($handle, $chunkSize);
                                flush();