1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Range requests: Extracted stream output handling to new class

This commit is contained in:
Dan Brown
2024-01-07 14:03:13 +00:00
parent b191d8f99f
commit b4d9029dc3
4 changed files with 80 additions and 28 deletions

View File

@@ -226,12 +226,13 @@ class AttachmentController extends Controller
$fileName = $attachment->getFileName();
$attachmentStream = $this->attachmentService->streamAttachmentFromStorage($attachment);
$attachmentSize = $this->attachmentService->getAttachmentFileSize($attachment);
if ($request->get('open') === 'true') {
return $this->download()->streamedInline($attachmentStream, $fileName);
return $this->download()->streamedInline($attachmentStream, $fileName, $attachmentSize);
}
return $this->download()->streamedDirectly($attachmentStream, $fileName);
return $this->download()->streamedDirectly($attachmentStream, $fileName, $attachmentSize);
}
/**