Skip to content

Commit c0bce02

Browse files
committedSep 3, 2024··
Warn if an actor has no id
1 parent 1ee5c16 commit c0bce02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎src/federation/middleware.ts

+12
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,18 @@ class FederationImpl<TContextData> implements Federation<TContextData> {
10861086
const actor = await dispatcher(context, handle);
10871087
if (actor == null) return null;
10881088
const logger = getLogger(["fedify", "federation", "actor"]);
1089+
if (actor.id == null) {
1090+
logger.warn(
1091+
"Actor dispatcher returned an actor without an id property. " +
1092+
"Set the property with Context.getActorUri(handle).",
1093+
);
1094+
} else if (actor.id.href != context.getActorUri(handle).href) {
1095+
logger.warn(
1096+
"Actor dispatcher returned an actor with an id property that " +
1097+
"does not match the actor URI. Set the property with " +
1098+
"Context.getActorUri(handle).",
1099+
);
1100+
}
10891101
if (
10901102
this.followingCallbacks != null &&
10911103
this.followingCallbacks.dispatcher != null

0 commit comments

Comments
 (0)
Please sign in to comment.