mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Closes #6609, closes #6610 ## Bug 1 — Handler.php returns HTTP 500 for ValidationException (#6609) `ValidationException` has no `getStatusCode()` method — only a `$status` property (default 422). The existing handler checked `method_exists($exception, 'getStatusCode')`, which returns false, so the fallback of 500 was used for every JSON API validation failure. Fix: use `$exception->status` as the fallback for `ValidationException`. ## Bug 2 — timelineHome rejects empty max_id=/min_id= parameters (#6610) The Pixelfed Android app (and other Mastodon-compatible clients such as Tusky and Ivory) send `max_id=` (empty string) on the first home timeline request. The `ConvertEmptyStringsToNull` middleware converts this to null before validation. The rule `'sometimes|integer'` still validated the key (it is "present" as null) and the `integer` rule failed on null, throwing a `ValidationException`. This then triggered bug #6609, returning HTTP 500. Every other timeline method in `ApiV1Controller` already uses `'nullable|integer'` for `max_id`/`min_id`. This commit makes `timelineHome` consistent. ## Tests `tests/Feature/HomeTimelineTest.php` adds four regression tests: 1. Validates that a non-integer `max_id` returns 422 (not 500) — catches the Handler.php regression independently of the controller fix. 2. Validates that `max_id=` (empty) returns a successful response — the exact request the Pixelfed Android app sends on first load. 3. Same for `min_id=`. 4. Validates that a non-null, non-integer `max_id` is still rejected (422), ensuring the `nullable` change does not weaken input validation. |
2 months ago | |
|---|---|---|
| .. | ||
| HomeTimelineTest.php | 2 months ago | |
| LoginTest.php | 1 year ago | |
| RemoteOidcTest.php | 1 year ago | |