allowance->allows($file, $request->user()), 403); $this->activity->log(Action::FileDownloaded, subject: $file); if ($file->disk !== 'files') { $url = Storage::disk($file->disk)->temporaryUrl( $file->path, now()->addHour(), ['ResponseContentDisposition' => ContentDisposition::attachment($file->original_name)], ); return redirect()->away($url); } return response('', 200, [ 'X-Accel-Redirect' => '/protected-files/'.$file->path, 'Content-Type' => $file->mime_type, 'Content-Disposition' => ContentDisposition::attachment($file->original_name), 'Content-Length' => (string) $file->size, ]); } }