Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw NotFound when a poster image doesn't exist #52

Open
wants to merge 1 commit into
base: dev.waterwolf.club
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading