Merge pull request #10524 from realkinetix/sanitize-ap-statuses-count

Sanitize negative status count on APContact
This commit is contained in:
Hypolite Petovan 2021-07-20 13:31:57 -04:00 committed by GitHub
commit 5d27c173b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -330,6 +330,11 @@ class APContact
$outbox = ActivityPub::fetchContent($apcontact['outbox']);
}
if (!empty($outbox['totalItems'])) {
// Mastodon seriously allows for this condition?
// Jul 20 2021 - See https://chaos.social/@m11 for a negative posts count
if ($outbox['totalItems'] < 0) {
$outbox['totalItems'] = 0;
}
$apcontact['statuses_count'] = $outbox['totalItems'];
}
}