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