Skip to content

Commit

Permalink
Fix an interop issue of lookupObject()
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed May 4, 2024
1 parent 4751d9a commit c47b7e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ To be released.
- Fixed a bug where the authenticated document loader had thrown `InvalidUrl`
error when the URL redirection was involved in Bun.

- Fixed a bug of `lookupObject()` that it had failed to look up the actor
object when WebFinger response had no links with
`"type": "application/activity+json"` but had `"type":
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""`.

[@fedify/cli]: https://jsr.io/@fedify/cli
[releases]: https://github.com/dahlia/fedify/releases
[FEP-8fcf]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md
Expand Down
7 changes: 6 additions & 1 deletion vocab/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ export async function lookupObject(
const jrd = await lookupWebFinger(identifier);
if (jrd?.links == null) return null;
for (const l of jrd.links) {
if (l.type !== "application/activity+json" || l.rel !== "self") continue;
if (
l.type !== "application/activity+json" &&
!l.type?.match(
/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/,
) || l.rel !== "self"
) continue;
try {
const remoteDoc = await documentLoader(l.href);
document = remoteDoc.document;
Expand Down

0 comments on commit c47b7e4

Please sign in to comment.