Fix actor lookup

This commit is contained in:
Thomas Sileo 2022-08-15 22:22:15 +02:00
parent d1b4bd0181
commit 4ae198d074
2 changed files with 3 additions and 4 deletions

View file

@ -103,7 +103,7 @@ async def get_lookup(
await fetch_actor( await fetch_actor(
db_session, ap_object.ap_id, save_if_not_found=False db_session, ap_object.ap_id, save_if_not_found=False
) )
except ap.NotAnObjectError: except ap.ObjectNotFoundError:
pass pass
else: else:
return RedirectResponse( return RedirectResponse(

View file

@ -3,7 +3,7 @@ import mf2py # type: ignore
from app import activitypub as ap from app import activitypub as ap
from app import webfinger from app import webfinger
from app.actor import Actor from app.actor import Actor
from app.actor import fetch_actor from app.actor import RemoteActor
from app.ap_object import RemoteObject from app.ap_object import RemoteObject
from app.database import AsyncSession from app.database import AsyncSession
@ -34,7 +34,6 @@ async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject:
raise raise
if ap.as_list(ap_obj["type"])[0] in ap.ACTOR_TYPES: if ap.as_list(ap_obj["type"])[0] in ap.ACTOR_TYPES:
actor = await fetch_actor(db_session, ap_obj["id"]) return RemoteActor(ap_obj)
return actor
else: else:
return await RemoteObject.from_raw_object(ap_obj) return await RemoteObject.from_raw_object(ap_obj)