Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85829842
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index 25f45783d..92ea0182a 100644
--- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@ -562,7 +562,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
# The validator builds the rest of an edit from the stored object.
defp fix_user_message(%User{}, %{"type" => "Update", "object" => object} = activity)
when is_map(object) do
- object = normalize_client_content(object)
+ object =
+ object
+ |> Map.drop(~w(source generator))
+ |> normalize_client_content()
with :ok <- check_character_limit(object) do
{:ok, Map.put(activity, "object", object)}
@@ -725,6 +728,11 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> put_status(:bad_request)
|> json(message)
+ {:error, {:validate, {:error, message}}} when is_binary(message) ->
+ conn
+ |> put_status(:bad_request)
+ |> json(message)
+
e ->
Logger.warning(fn -> "AP C2S: #{inspect(e)}" end)
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_c2s_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_c2s_test.exs
index 3784cbd2e..bbd4d4c91 100644
--- a/test/pleroma/web/activity_pub/activity_pub_controller_c2s_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_c2s_test.exs
@@ -224,10 +224,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerC2STest do
"formerRepresentations" => forged
}
+ object = Map.put(object, "source", %{"content" => "fake", "mediaType" => "text/plain"})
post_outbox(conn, ctx.user, update(object), 201)
data = Object.get_by_ap_id(ctx.object_id).data
assert data["content"] == "now"
+ refute data["source"]["content"] == "fake"
assert [%{"content" => "hello"}] = data["formerRepresentations"]["orderedItems"]
refute data["updated"] =~ "2999"
end
@@ -414,7 +416,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerC2STest do
user = insert(:user)
attachments = for _ <- 1..3, do: upload(user)
- post_outbox(conn, user, note(%{"attachment" => attachments}), 400)
+ assert post_outbox(conn, user, note(%{"attachment" => attachments}), 400) =~ "attachments"
long = Map.put(upload(user), "name", String.duplicate("n", 21))
post_outbox(conn, user, note(%{"attachment" => [long]}), 400)
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Nov 1, 12:50 AM (15 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1802007
Default Alt Text
(2 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline