log = $logger; } /** * download logfile * * @psalm-suppress MoreSpecificReturnType The value of Content-Disposition is not relevant * @psalm-suppress LessSpecificReturnStatement The value of Content-Disposition is not relevant * @return StreamResponse * * 200: Logfile returned */ #[NoCSRFRequired] public function download() { if (!$this->log instanceof Log) { throw new \UnexpectedValueException('Log file not available'); } $resp = new StreamResponse($this->log->getLogPath()); $resp->setHeaders([ 'Content-Type' => 'application/octet-stream', 'Content-Disposition' => 'attachment; filename="nextcloud.log"', ]); return $resp; } }