Skip to content

Commit

Permalink
Ensure allowed_filters includes status filter
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed May 30, 2024
1 parent f019401 commit 98760c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Http/Controllers/API/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ protected function abortIfUnpublished(Request $request, $item)
return;
}

// todo: we should also be checking that allowed_filters contains 'status'
if ($request->boolean('draft')) {
if (in_array('status', $this->allowedFilters()) && $request->boolean('draft')) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/Http/Controllers/API/CollectionEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function show(Request $request, $collection, $handle)
$this->abortIfDisabled();

$entry = Entry::find($handle);
$this->collectionHandle = $entry?->collectionHandle();

$this->abortIfInvalid($entry, $collection);
$this->abortIfUnpublished($request, $entry);
Expand Down

0 comments on commit 98760c6

Please sign in to comment.