Skip to content

Commit c47b7e4

Browse files
committed
Fix an interop issue of lookupObject()
1 parent 4751d9a commit c47b7e4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ To be released.
8080
- Fixed a bug where the authenticated document loader had thrown `InvalidUrl`
8181
error when the URL redirection was involved in Bun.
8282

83+
- Fixed a bug of `lookupObject()` that it had failed to look up the actor
84+
object when WebFinger response had no links with
85+
`"type": "application/activity+json"` but had `"type":
86+
"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""`.
87+
8388
[@fedify/cli]: https://jsr.io/@fedify/cli
8489
[releases]: https://github.com/dahlia/fedify/releases
8590
[FEP-8fcf]: https://codeberg.org/fediverse/fep/src/branch/main/fep/8fcf/fep-8fcf.md

vocab/lookup.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ export async function lookupObject(
8181
const jrd = await lookupWebFinger(identifier);
8282
if (jrd?.links == null) return null;
8383
for (const l of jrd.links) {
84-
if (l.type !== "application/activity+json" || l.rel !== "self") continue;
84+
if (
85+
l.type !== "application/activity+json" &&
86+
!l.type?.match(
87+
/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/,
88+
) || l.rel !== "self"
89+
) continue;
8590
try {
8691
const remoteDoc = await documentLoader(l.href);
8792
document = remoteDoc.document;

0 commit comments

Comments
 (0)