summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/OC_Files.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/legacy/OC_Files.php')
-rw-r--r--lib/private/legacy/OC_Files.php44
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index 249d3e5154f..72983f50d9c 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -84,19 +84,19 @@ class OC_Files {
$type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename));
if ($fileSize > -1) {
if (!empty($rangeArray)) {
- http_response_code(206);
- header('Accept-Ranges: bytes', true);
- if (count($rangeArray) > 1) {
+ http_response_code(206);
+ header('Accept-Ranges: bytes', true);
+ if (count($rangeArray) > 1) {
$type = 'multipart/byteranges; boundary='.self::getBoundary();
// no Content-Length header here
- }
- else {
+ }
+ else {
header(sprintf('Content-Range: bytes %d-%d/%d', $rangeArray[0]['from'], $rangeArray[0]['to'], $fileSize), true);
OC_Response::setContentLengthHeader($rangeArray[0]['to'] - $rangeArray[0]['from'] + 1);
- }
+ }
}
else {
- OC_Response::setContentLengthHeader($fileSize);
+ OC_Response::setContentLengthHeader($fileSize);
}
}
header('Content-Type: '.$type, true);
@@ -329,10 +329,10 @@ class OC_Files {
if (!empty($rangeArray)) {
try {
- if (count($rangeArray) == 1) {
+ if (count($rangeArray) == 1) {
$view->readfilePart($filename, $rangeArray[0]['from'], $rangeArray[0]['to']);
- }
- else {
+ }
+ else {
// check if file is seekable (if not throw UnseekableException)
// we have to check it before body contents
$view->readfilePart($filename, $rangeArray[0]['size'], $rangeArray[0]['size']);
@@ -340,24 +340,24 @@ class OC_Files {
$type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename));
foreach ($rangeArray as $range) {
- echo "\r\n--".self::getBoundary()."\r\n".
- "Content-type: ".$type."\r\n".
- "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n";
- $view->readfilePart($filename, $range['from'], $range['to']);
+ echo "\r\n--".self::getBoundary()."\r\n".
+ "Content-type: ".$type."\r\n".
+ "Content-range: bytes ".$range['from']."-".$range['to']."/".$range['size']."\r\n\r\n";
+ $view->readfilePart($filename, $range['from'], $range['to']);
}
echo "\r\n--".self::getBoundary()."--\r\n";
- }
+ }
} catch (\OCP\Files\UnseekableException $ex) {
- // file is unseekable
- header_remove('Accept-Ranges');
- header_remove('Content-Range');
- http_response_code(200);
- self::sendHeaders($filename, $name, []);
- $view->readfile($filename);
+ // file is unseekable
+ header_remove('Accept-Ranges');
+ header_remove('Content-Range');
+ http_response_code(200);
+ self::sendHeaders($filename, $name, []);
+ $view->readfile($filename);
}
}
else {
- $view->readfile($filename);
+ $view->readfile($filename);
}
}