Skip to content

Commit

Permalink
Get rid of false infinite loop warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Jun 16, 2024
1 parent 59e7d4d commit 6c2db22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion federation/handler.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getLogger } from "@logtape/logtape";
import { accepts } from "@std/http/negotiation";
import type { DocumentLoader } from "../runtime/docloader.ts";
import { verifyRequest } from "../sig/http.ts";
import { doesActorOwnKey } from "../sig/owner.ts";
import { verifyObject } from "../sig/proof.ts";
import type { DocumentLoader } from "../runtime/docloader.ts";
import type { Recipient } from "../vocab/actor.ts";
import {
Activity,
Expand Down Expand Up @@ -61,6 +61,9 @@ export async function handleActor<TContextData>(
}: ActorHandlerParameters<TContextData>,
): Promise<Response> {
if (actorDispatcher == null) return await onNotFound(request);
// FIXME: When the deprecated last parameter (key) of ActorDispatcher
// is removed, replace the below line with a direct all to
// actorDispatcher:
const actor = await context.getActor(handle);
if (actor == null) return await onNotFound(request);
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
Expand Down
8 changes: 5 additions & 3 deletions federation/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1243,9 +1243,11 @@ export class Federation<TContextData> {
nodeInfoDispatcher: this.#nodeInfoDispatcher!,
});
case "actor":
context = this.#createContext(request, contextData, {
invokedFromActorDispatcher: { handle: route.values.handle },
});
// FIXME: When the deprecated last parameter (key) of ActorDispatcher
// is removed, uncomment the following line.
// context = this.#createContext(request, contextData, {
// invokedFromActorDispatcher: { handle: route.values.handle },
// });
return await handleActor(request, {
handle: route.values.handle,
context,
Expand Down

0 comments on commit 6c2db22

Please sign in to comment.