Add patch for id-less anonymous objects

This commit is contained in:
Oneric 2024-11-10 03:03:10 +01:00
parent 06ac5737c5
commit dfd21fb416
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,70 @@
From 0f9c9aac380a3864ee0099e2d398b395feda9fdc Mon Sep 17 00:00:00 2001
From: Oneric <oneric@oneric.stub>
Date: Sat, 9 Nov 2024 16:52:12 +0100
Subject: [PATCH] Completely omit id for anonymous objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Current AP spec demands anonymous objects to have an id value,
but explicitly set it to JSON null. Howeveras it turns out this is
incompatible with JSON-LD requiring `@id` to be a string and thus AP
spec is incompatible iwth the Ativity Streams spec it is based on.
This is an issue for (the few) AP implementers actually performing
JSON-LD processing, like IceShrimp.NET.
This was uncovered by IceShrimp.NETs zotan due to our adoption of
anonymous objects for emoj in f1018867097e6f293d8b2b5b6935f0a7ebf99bd0.
The issues is being discussed by W3C, and will most likely be resolved
via an errata redefining anonymous objects to completely omit the id
field just like transient objects already do. See:
https://github.com/w3c/activitypub/issues/476
Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/848
---
lib/pleroma/web/activity_pub/transmogrifier.ex | 3 +--
.../web/activity_pub/transmogrifier/note_handling_test.exs | 1 -
test/pleroma/web/activity_pub/views/user_view_test.exs | 1 -
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 75c1f0f0c..5c4db39b9 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -950,8 +950,7 @@ defp build_emoji_tag({name, url}) do
"icon" => %{"url" => "#{URI.encode(url)}", "type" => "Image"},
"name" => ":" <> name <> ":",
"type" => "Emoji",
- "updated" => "1970-01-01T00:00:00Z",
- "id" => nil
+ "updated" => "1970-01-01T00:00:00Z"
}
end
diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
index 92a096c2d..234a48990 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
@@ -698,7 +698,6 @@ test "take_emoji_tags/1" do
assert Transmogrifier.take_emoji_tags(user) == [
%{
"icon" => %{"type" => "Image", "url" => "https://example.org/firefox.png"},
- "id" => nil,
"name" => ":firefox:",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z"
diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs
index 7e251e510..4283fb0c8 100644
--- a/test/pleroma/web/activity_pub/views/user_view_test.exs
+++ b/test/pleroma/web/activity_pub/views/user_view_test.exs
@@ -47,7 +47,6 @@ test "Renders with emoji tags" do
"tag" => [
%{
"icon" => %{"type" => "Image", "url" => "/test"},
- "id" => nil,
"name" => ":bib:",
"type" => "Emoji",
"updated" => "1970-01-01T00:00:00Z"
--
2.43.0

View file

@ -13,3 +13,5 @@ pr814_10_fix-swagger-ui.patch
pr642_receive-mathml.patch
# Avoid unecessary work
pr582_dont-fetch-remote-uris-on-unauthenticated-search.patch
# Bug in AP spec; current wording for anonymous objects is incompatible with JSON-LD
pr850_ap-anonymous-errata.patch