diff --git a/src/server/fetcher.rs b/src/server/fetcher.rs index d49c073e..fe4602ef 100644 --- a/src/server/fetcher.rs +++ b/src/server/fetcher.rs @@ -297,6 +297,13 @@ async fn fetch_object_inner(ctx: &Context, id: &str, depth: usize) -> crate::Res .exec(ctx.db()) .await?; } + // lemmy sends us an image field in posts, treat it like an attachment i'd say + if let Some(img) = object.image().get() { + let attachment_model = model::attachment::ActiveModel::new(img, object_model.id.clone())?; + model::attachment::Entity::insert(attachment_model) + .exec(ctx.db()) + .await?; + } let expanded_addresses = ctx.expand_addressing(addressed).await?; ctx.address_to(None, Some(&object_model.id), &expanded_addresses).await?; diff --git a/src/server/inbox.rs b/src/server/inbox.rs index 84eb03e1..6df520cf 100644 --- a/src/server/inbox.rs +++ b/src/server/inbox.rs @@ -59,6 +59,13 @@ impl apb::server::Inbox for Context { .exec(self.db()) .await?; } + // lemmy sends us an image field in posts, treat it like an attachment i'd say + if let Some(img) = object.image().get() { + let attachment_model = model::attachment::ActiveModel::new(img, object_model.id.clone())?; + model::attachment::Entity::insert(attachment_model) + .exec(ctx.db()) + .await?; + } // TODO can we even receive anonymous objects? if let Some(object_author) = uid { model::user::Entity::update_many()