Skip to content

Commit

Permalink
Throw NotFound when a poster image doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
gmemstr committed Aug 23, 2024
1 parent a799201 commit 50f5db8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/src/Controller/Posters/GetPosterAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Controller\Posters;

use App\Environment;
use App\Exception\NotFoundException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Media;
Expand Down Expand Up @@ -140,11 +141,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);
Expand Down

0 comments on commit 50f5db8

Please sign in to comment.