]> git.mxchange.org Git - friendica.git/commitdiff
Negative numbers in following is a thing too
authorRealKinetix <kinetix@isurf.ca>
Wed, 14 Jul 2021 20:51:30 +0000 (13:51 -0700)
committerRealKinetix <kinetix@isurf.ca>
Wed, 14 Jul 2021 20:51:30 +0000 (13:51 -0700)
Check & sanitize 'following' as well, as per:
https://mastodon.social/@BLUW

src/Model/APContact.php

index 64f45a8451869f5f08a6deaca23c3bd14465dd22..1ae34a40a834e162d4bb1f21aa9b1da635e5dc13 100644 (file)
@@ -266,6 +266,11 @@ class APContact
                if (!empty($apcontact['following'])) {
                        $following = ActivityPub::fetchContent($apcontact['following']);
                        if (!empty($following['totalItems'])) {
+                               // Mastodon seriously allows for this condition? 
+                               // Jul 14 2021 - See https://mastodon.social/@BLUW for a negative following count
+                               if ($following['totalItems'] < 0) {
+                                       $following['totalItems'] = 0;
+                               }
                                $apcontact['following_count'] = $following['totalItems'];
                        }
                }