Exception occur when seeing restricted pinned statuses on remote mastodon
Environment
- Installation type (OTP or From Source): OTP
- Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): 2.4.3
- Elixir version (
elixir -v
for from source installations, N/A for OTP): N/A - Operating system: Ubuntu 20.04
- PostgreSQL version (
psql -V
): 12
Bug description
Ran into exceptions in my server log very often, they are all from different ids and servers (server and status id masked below)
Sep 16 12:59:33 Varuna pleroma[15663]: 12:59:33.311 request_id=XYZ [error] Internal server error: %FunctionClauseError{args: nil, arity: 1, clauses: nil, function: :"-pin_data_from_featured_collection/1-fun-0-", kind: nil, module: Pleroma.Web.ActivityPub.ActivityPub}
Sep 16 12:59:33 Varuna pleroma[15663]: 12:59:33.317 [error] #PID<0.9523.0> running Pleroma.Web.Endpoint (connection #PID<0.9522.0>, stream id 1) terminated
Sep 16 12:59:33 Varuna pleroma[15663]: Server: server.net:80 (http)
Sep 16 12:59:33 Varuna pleroma[15663]: Request: POST /inbox
Sep 16 12:59:33 Varuna pleroma[15663]: ** (exit) an exception was raised:
Sep 16 12:59:33 Varuna pleroma[15663]: ** (FunctionClauseError) no function clause matching in anonymous fn/1 in Pleroma.Web.ActivityPub.ActivityPub.pin_data_from_featured_collection/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1617: anonymous fn("https://mastodon.server/users/ABC/statuses/123") in Pleroma.Web.ActivityPub.ActivityPub.pin_data_from_featured_collection/1
Sep 16 12:59:33 Varuna pleroma[15663]: (elixir 1.10.4) lib/map.ex:217: Map.new_transform/3
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1626: Pleroma.Web.ActivityPub.ActivityPub.fetch_and_prepare_featured_from_ap_id/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1436: Pleroma.Web.ActivityPub.ActivityPub.object_to_user_data/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1562: Pleroma.Web.ActivityPub.ActivityPub.user_data_from_user_object/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1570: Pleroma.Web.ActivityPub.ActivityPub.fetch_and_prepare_user_from_ap_id/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/web/activity_pub/activity_pub.ex:1653: Pleroma.Web.ActivityPub.ActivityPub.make_user_from_ap_id/1
Sep 16 12:59:33 Varuna pleroma[15663]: (pleroma 2.4.3) lib/pleroma/user.ex:1884: Pleroma.User.get_or_fetch_by_ap_id/1
when I trying to GET https://mastodon.server/users/ABC/statuses/123
, it's almost certainly a 404, but it does exists in https://mastodon.server/users/ABC/KatherineLovesCats/collections/featured
with id only but no detail:
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"ostatus": "http://ostatus.org#",
"atomUri": "ostatus:atomUri",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
"conversation": "ostatus:conversation",
"sensitive": "as:sensitive",
"toot": "http://joinmastodon.org/ns#",
"votersCount": "toot:votersCount"
}
],
"id": "https://mastodon.server/users/ABC/collections/featured",
"type": "OrderedCollection",
"totalItems": 2,
"orderedItems": [
{
"id": "https://mastodon.server/users/ABC/statuses/456",
"type": "Note",
"summary": null,
"inReplyTo": null,
"content": "...",
...
},
"https://mastodon.server/users/ABC/statuses/123"
]
}
So I assume it's a follower-only or private status but somehow Mastodon do allow its id going to featured collection and federating.
I guess Pleroma just need to be a bit tolerant and skip when this is not accessible, instead of raising exception.