Skip to content

Commit

Permalink
Throw 404 exception on Taxonomy Term Entries endpoint when term doesn…
Browse files Browse the repository at this point in the history
…'t exist
  • Loading branch information
duncanmcclean committed Jan 8, 2024
1 parent 720d8a8 commit 48f9c93
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Http/Controllers/API/TaxonomyTermEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Facades\Statamic\API\FilterAuthorizer;
use Facades\Statamic\API\ResourceAuthorizer;
use Statamic\Exceptions\NotFoundHttpException;
use Statamic\Facades\Collection;
use Statamic\Facades\Term;
use Statamic\Http\Resources\API\EntryResource;
Expand Down Expand Up @@ -32,6 +33,8 @@ public function index($taxonomy, $term)

$term = Term::find($taxonomy.'::'.$term);

throw_unless($term, new NotFoundHttpException);

$query = $term->queryEntries();

$this->allowedCollections = $this->allowedCollections();
Expand Down

0 comments on commit 48f9c93

Please sign in to comment.