From c180f9276fe9c6d6e7c5d25165bf87606cd1c966 Mon Sep 17 00:00:00 2001 From: marcin mikołajczak Date: Wed, 19 Jan 2022 17:19:28 +0100 Subject: check if remote bday is valid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- lib/pleroma/web/activity_pub/activity_pub.ex | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 837f4b82a..e1f94ba9c 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1501,6 +1501,16 @@ defp object_to_user_data(data) do nil end + birth_date = + if data["vcard:bday"] do + case Date.from_iso8601(data["vcard:bday"]) do + {:ok, date} -> date + {:error, _} -> nil + end + else + nil + end + user_data = %{ ap_id: data["id"], uri: get_actor_url(data["url"]), @@ -1524,7 +1534,7 @@ defp object_to_user_data(data) do shared_inbox: shared_inbox, accepts_chat_messages: accepts_chat_messages, pinned_objects: pinned_objects, - birth_date: data["vcard:bday"] + birth_date: birth_date } # nickname can be nil because of virtual actors -- cgit v1.2.3