diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-05-19 07:30:02 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-05-19 03:28:29 -0500 |
commit | 2051530868720a23715cbb0d1a1286a6ae1a6507 (patch) | |
tree | 61a36962e02b00e59d41b2a9488dcdfb59c1770c /lib | |
parent | 4d2c6707c2f5f7723f1fcf03cdbf9476f2d5b3ad (diff) | |
download | pleroma-2051530868720a23715cbb0d1a1286a6ae1a6507.tar.gz |
activitypub transmogrifier: handle hubzilla AP actor quirks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 491ad3705..3e1977f96 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -401,6 +401,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do "url" => [%{"href" => data["image"]["url"]}] } + data = Transmogrifier.maybe_fix_user_object(data) + user_data = %{ ap_id: data["id"], info: %{ diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 463d1e59d..c10d27dcd 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -495,4 +495,17 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do Repo.delete_all(q) end end + + def maybe_fix_user_url(data) do + if is_map(data["url"]) do + data = Map.put(data, "url", data["url"]["href"]) + end + + data + end + + def maybe_fix_user_object(data) do + data + |> maybe_fix_user_url + end end |