From 979e18eeb737e92282b1e4c26085e1df8c50885e Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Fri, 23 Aug 2024 13:06:10 +0100 Subject: [PATCH] Throw NotFound when a poster image doesn't exist --- backend/src/Controller/Posters/GetPosterAction.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/Controller/Posters/GetPosterAction.php b/backend/src/Controller/Posters/GetPosterAction.php index 32133e1..7587b4e 100644 --- a/backend/src/Controller/Posters/GetPosterAction.php +++ b/backend/src/Controller/Posters/GetPosterAction.php @@ -140,11 +140,9 @@ public function __invoke( ); } - // Default poster if no other image is found. + // Return 404 if poster image isn't found if (null === $image) { - $image = file_get_contents( - Environment::getBaseDirectory() . '/web/static/img/no_poster.jpg' - ); + throw NotFoundException::poster($request); } $response->getBody()->write($image);