ticket; if ($ticket !== null) { Gate::authorize('view', $ticket); } abort_unless(Storage::disk($attachment->disk)->exists($attachment->path), 404); if ($attachment->isSourceCode()) { $contents = Storage::disk($attachment->disk)->get($attachment->path); return view('helpdesk::attachments.source-preview', [ 'attachment' => $attachment, 'contents' => is_string($contents) ? $contents : '', 'language' => $attachment->language(), ]); } abort_unless($attachment->isPreviewableBinary(), 404); return Storage::disk($attachment->disk)->response($attachment->path, $attachment->original_name, [ 'Content-Disposition' => 'inline; filename="' . addslashes($attachment->original_name) . '"', 'X-Content-Type-Options' => 'nosniff', ]); } }