filesService = $filesService; } /** * Handles GET requests to download/view a file. * * Validates that the current user has access to the project the file belongs to * before serving the file content. * * @return Response The file content response, 403 if unauthorized, or 404 if not found. * * @throws \Exception */ public function get(): Response { $rawEncName = $_GET['encName'] ?? ''; $encName = preg_replace('/[^a-zA-Z0-9]+/', '', $rawEncName); if (empty($encName)) { return new Response('Bad request', 400); } return $this->filesService->getFileForUser($encName, (int) session('userdata.id')); } }