X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/85154fff693c80374bc048ca9497df663bd5e32d..refs/pull/3698/head:/app/Http/Controllers/AttachmentController.php diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 445611fcb..03e362f4a 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -9,15 +9,14 @@ use BookStack\Uploads\Attachment; use BookStack\Uploads\AttachmentService; use Exception; use Illuminate\Contracts\Filesystem\FileNotFoundException; -use Illuminate\Foundation\Http\Middleware\ValidatePostSize; use Illuminate\Http\Request; use Illuminate\Support\MessageBag; use Illuminate\Validation\ValidationException; class AttachmentController extends Controller { - protected $attachmentService; - protected $pageRepo; + protected AttachmentService $attachmentService; + protected PageRepo $pageRepo; /** * AttachmentController constructor. @@ -231,13 +230,13 @@ class AttachmentController extends Controller } $fileName = $attachment->getFileName(); - $attachmentContents = $this->attachmentService->getAttachmentFromStorage($attachment); + $attachmentStream = $this->attachmentService->streamAttachmentFromStorage($attachment); if ($request->get('open') === 'true') { - return $this->inlineDownloadResponse($attachmentContents, $fileName); + return $this->download()->streamedInline($attachmentStream, $fileName); } - return $this->downloadResponse($attachmentContents, $fileName); + return $this->download()->streamedDirectly($attachmentStream, $fileName); } /**