'.+'])] public function index( string $name, string $path, #[Autowire(service: 'oneup_flysystem.themes_filesystem')] FilesystemOperator $filesystem ): Response { $themeDir = basename($name); if (!$filesystem->directoryExists($themeDir)) { throw $this->createNotFoundException('The folder name does not exist.'); } $filePath = $this->themeHelper->getFileLocation($path); if (!$filePath) { throw $this->createNotFoundException('The requested file does not exist.'); } $response = new StreamedResponse(function () use ($filesystem, $filePath): void { $outputStream = fopen('php://output', 'wb'); $fileStream = $filesystem->readStream($filePath); stream_copy_to_stream($fileStream, $outputStream); }); $mimeType = $filesystem->mimeType($filePath); $disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, basename($path)); $response->headers->set('Content-Disposition', $disposition); $response->headers->set('Content-Type', $mimeType ?: 'application/octet-stream'); return $response; } }