Fix home timeline rejecting empty max_id/min_id pagination params

`GET /api/v1/timelines/home?max_id=` (empty value) fails validation
because `min_id`/`max_id` use the `sometimes|integer` rule. The global
`ConvertEmptyStringsToNull` middleware turns `?max_id=` into `null`, and
since the field is present, `sometimes` does not skip it while `null`
fails the `integer` rule — returning HTTP 422.

Every other timeline/listing endpoint in this controller (timelinePublic,
accountStatusesById, etc.) uses `nullable|integer` for these params, so
`timelineHome` was the lone outlier. Mastodon-API clients such as Pixelfed
for iOS send `max_id=` on first page load and could not paginate the home
timeline.

Switch `min_id`/`max_id` to `nullable|integer` to match the rest of the
controller.

Fixes #6610

Co-Authored-By: Claude <noreply@anthropic.com>
pull/6655/head
TowyTowy 4 days ago
parent 0f781cba34
commit 795473be55

@ -2607,8 +2607,8 @@ class ApiV1Controller extends Controller
$this->validate($request, [
'page' => 'sometimes|integer|max:40',
'min_id' => 'sometimes|integer|min:0|max:'.PHP_INT_MAX,
'max_id' => 'sometimes|integer|min:0|max:'.PHP_INT_MAX,
'min_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'max_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'limit' => 'sometimes|integer|min:1',
'include_reblogs' => 'sometimes',
]);

Loading…
Cancel
Save