diff --git a/CHANGELOG.md b/CHANGELOG.md index d8dbec9fc..57551cd5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ - Updated ApiV1Controller, fix illegal operator bug by setting default min_id. ([415826f2](https://github.com/pixelfed/pixelfed/commit/415826f2)) - Updated StatusService, add getMastodon method for mastoapi compatibility. ([36a129fe](https://github.com/pixelfed/pixelfed/commit/36a129fe)) - Updated PublicApiController, fix accountStatuses pagination operator. ([85fc9dd0](https://github.com/pixelfed/pixelfed/commit/85fc9dd0)) +- Updated PublicApiController, enforce only_media on accountStatuses method. Fixes #3105. ([861a2d36](https://github.com/pixelfed/pixelfed/commit/861a2d36)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index b678694b4..f31aca727 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -737,6 +737,7 @@ class PublicApiController extends Controller $max_id = $request->max_id; $min_id = $request->min_id; $scope = ['photo', 'photo:album', 'video', 'video:album']; + $onlyMedia = $request->input('only_media', true); if(!$min_id && !$max_id) { $min_id = 1; @@ -787,7 +788,16 @@ class PublicApiController extends Controller } return $status; }) - ->filter(function($s) { + ->filter(function($s) use($onlyMedia) { + if($onlyMedia) { + if( + !isset($s['media_attachments']) || + !is_array($s['media_attachments']) || + empty($s['media_attachments']) + ) { + return false; + } + } return $s; }) ->values();