@@ -284,46 +284,46 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $response->setOutputFormat(null) |
| 287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 288 | - $mime = $node->getContentType(); |
|
| 289 | - $stream = $node->get(); |
|
| 290 | - $name = $node->getName(); |
|
| 291 | - |
|
| 292 | - if (null === $stream) { |
|
| 293 | - return; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - if (0 !== $offset) { |
|
| 297 | - if (fseek($stream, $offset) === -1) { |
|
| 298 | - throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
| 299 | - } |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - $read = 0; |
|
| 303 | - header('Content-Type: '.$mime.''); |
|
| 304 | - if ('base64' === $encode) { |
|
| 305 | - header('Content-Encoding: base64'); |
|
| 306 | - while (!feof($stream)) { |
|
| 307 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 308 | - echo base64_encode(fread($stream, $length - $read)); |
|
| 309 | - exit(); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - echo base64_encode(fread($stream, 8192)); |
|
| 313 | - $read += 8192; |
|
| 314 | - } |
|
| 315 | - } else { |
|
| 316 | - while (!feof($stream)) { |
|
| 317 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 318 | - echo fread($stream, $length - $read); |
|
| 319 | - exit(); |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - echo fread($stream, 8192); |
|
| 323 | - $read += 8192; |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - }); |
|
| 287 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 288 | + $mime = $node->getContentType(); |
|
| 289 | + $stream = $node->get(); |
|
| 290 | + $name = $node->getName(); |
|
| 291 | + |
|
| 292 | + if (null === $stream) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + if (0 !== $offset) { |
|
| 297 | + if (fseek($stream, $offset) === -1) { |
|
| 298 | + throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
| 299 | + } |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + $read = 0; |
|
| 303 | + header('Content-Type: '.$mime.''); |
|
| 304 | + if ('base64' === $encode) { |
|
| 305 | + header('Content-Encoding: base64'); |
|
| 306 | + while (!feof($stream)) { |
|
| 307 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 308 | + echo base64_encode(fread($stream, $length - $read)); |
|
| 309 | + exit(); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + echo base64_encode(fread($stream, 8192)); |
|
| 313 | + $read += 8192; |
|
| 314 | + } |
|
| 315 | + } else { |
|
| 316 | + while (!feof($stream)) { |
|
| 317 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 318 | + echo fread($stream, $length - $read); |
|
| 319 | + exit(); |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + echo fread($stream, 8192); |
|
| 323 | + $read += 8192; |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + }); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -1318,9 +1318,9 @@ discard block |
||
| 1318 | 1318 | $node->zip($archive); |
| 1319 | 1319 | } catch (\Exception $e) { |
| 1320 | 1320 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
| 1321 | - 'category' => get_class($this), |
|
| 1322 | - 'exception' => $e, |
|
| 1323 | - ]); |
|
| 1321 | + 'category' => get_class($this), |
|
| 1322 | + 'exception' => $e, |
|
| 1323 | + ]); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | } |
| 1326 | 1326 | |