'.+'])] public function index(string $filename): Response { try { if (false === $this->xmlDumpReader->fileExists($filename)) { throw $this->createNotFoundException('Dump file not found. It may have been cleaned up.'); } $content = $this->xmlDumpReader->getContent($filename); } catch (FilesystemException $e) { throw $this->createNotFoundException('Failed to read dump file: '.$e->getMessage()); } $response = new Response($content); $response->headers->set('Content-Type', 'application/xml'); $disposition = $response->headers->makeDisposition( ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($filename) ); $response->headers->set('Content-Disposition', $disposition); return $response; } }