Fix for processing objects from Birdsite LIVE
parent
164cd9bd00
commit
36a1a6bd9c
33
app/actor.py
33
app/actor.py
|
@ -218,24 +218,23 @@ async def fetch_actor(
|
||||||
|
|
||||||
if save_if_not_found:
|
if save_if_not_found:
|
||||||
ap_actor = await ap.fetch(actor_id)
|
ap_actor = await ap.fetch(actor_id)
|
||||||
# Some softwares uses URL when we expect ID
|
# Some softwares uses URL when we expect ID or uses a different casing
|
||||||
if actor_id == ap_actor.get("url"):
|
# (like Birdsite LIVE) , which mean we may already have it in DB
|
||||||
# Which mean we may already have it in DB
|
existing_actor_by_url = (
|
||||||
existing_actor_by_url = (
|
await db_session.scalars(
|
||||||
await db_session.scalars(
|
select(models.Actor).where(
|
||||||
select(models.Actor).where(
|
models.Actor.ap_id == ap.get_id(ap_actor),
|
||||||
models.Actor.ap_id == ap.get_id(ap_actor),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
).one_or_none()
|
)
|
||||||
if existing_actor_by_url:
|
).one_or_none()
|
||||||
# Update the actor as we had to fetch it anyway
|
if existing_actor_by_url:
|
||||||
await update_actor_if_needed(
|
# Update the actor as we had to fetch it anyway
|
||||||
db_session,
|
await update_actor_if_needed(
|
||||||
existing_actor_by_url,
|
db_session,
|
||||||
RemoteActor(ap_actor),
|
existing_actor_by_url,
|
||||||
)
|
RemoteActor(ap_actor),
|
||||||
return existing_actor_by_url
|
)
|
||||||
|
return existing_actor_by_url
|
||||||
|
|
||||||
return await save_actor(db_session, ap_actor)
|
return await save_actor(db_session, ap_actor)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue