bridgy-fed
bridgy-fed copied to clipboard
ActivityPub: handle fragments in ids
There's a steady trickle of ActivityPub object ids that have fragments. Fetching/dereferencing fragment ids isn't specified in AP, but best practice seems to be to at least fetch the URI without the fragment and then try to load the fragment as a top-level property in the returned object: https://github.com/w3c/activitypub/issues/367 , https://www.w3.org/wiki/ActivityPub/Primer/Object_identifiers
Pretty much the whole of the linked data stack revolves around fragids which denote "Things" as opposed to "Documents".
Documents have meta data and headers, such as "created", if you mix that with a fragid, you create an ambiguity as to what was created, e.g. the Actor or the Document.
In some cases it might continue gracefully, in others it would fail catastrophically. For example in Solid, or WebID, or any system where there's more than one item on a page, you could be in trouble.
Better to include fragids as it's the more powerful form. To get the object, simply go to the document and look for a field where the @id is the fragid. This is a nice way of dealing with nested objects, too.
Thank you! I'm not sure how much any of this applies to the fediverse right now in practice, but it is helpful in general.