Skip to content
Snippets Groups Projects
Commit ea12371a authored by kaniini's avatar kaniini
Browse files

Merge branch 'discard-invalid-likes' into 'develop'

Transmogrifier: fix incoming objects with invalid likes

See merge request pleroma/pleroma!724
parents 00fd9c9e 77f21373
No related branches found
No related tags found
No related merge requests found
......@@ -141,11 +141,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> Map.put("actor", get_actor(%{"actor" => actor}))
end
def fix_likes(%{"likes" => likes} = object)
when is_bitstring(likes) do
# Check for standardisation
# This is what Peertube does
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
# Check for standardisation
# This is what Peertube does
# curl -H 'Accept: application/activity+json' $likes | jq .totalItems
# Prismo returns only an integer (count) as "likes"
def fix_likes(%{"likes" => likes} = object) when not is_map(likes) do
object
|> Map.put("likes", [])
|> Map.put("like_count", 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment