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