mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-13 12:44:51 +00:00
Merge branch 'bugfix/content_nil_lenght_check' into 'develop'
Web.ActivityPub.ActivityPub: Fix check_remote_limit/1 against activities with content: nil See merge request pleroma/pleroma!711
This commit is contained in:
commit
b050d27c2d
2 changed files with 12 additions and 1 deletions
|
@ -64,7 +64,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
end
|
||||
end
|
||||
|
||||
defp check_remote_limit(%{"object" => %{"content" => content}}) do
|
||||
defp check_remote_limit(%{"object" => %{"content" => content}}) when not is_nil(content) do
|
||||
limit = Pleroma.Config.get([:instance, :remote_limit])
|
||||
String.length(content) <= limit
|
||||
end
|
||||
|
|
|
@ -85,6 +85,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
assert {:error, {:remote_limit_error, _}} = ActivityPub.insert(data)
|
||||
end
|
||||
|
||||
test "doesn't drop activities with content being null" do
|
||||
data = %{
|
||||
"ok" => true,
|
||||
"object" => %{
|
||||
"content" => nil
|
||||
}
|
||||
}
|
||||
|
||||
assert {:ok, _} = ActivityPub.insert(data)
|
||||
end
|
||||
|
||||
test "returns the activity if one with the same id is already in" do
|
||||
activity = insert(:note_activity)
|
||||
{:ok, new_activity} = ActivityPub.insert(activity.data)
|
||||
|
|
Loading…
Reference in a new issue