From: Felix Ableitner Date: Fri, 14 Aug 2020 14:50:21 +0000 (+0200) Subject: Fix crash in federation tests X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/static/%7BpictrsAvatarThumbnail%28?a=commitdiff_plain;h=2a3b475b99c8cffc6b1f88ae958cf80ec5d46a71;p=lemmy.git Fix crash in federation tests --- diff --git a/server/src/apub/fetcher.rs b/server/src/apub/fetcher.rs index d031fa19..d8eaf70a 100644 --- a/server/src/apub/fetcher.rs +++ b/server/src/apub/fetcher.rs @@ -325,8 +325,10 @@ async fn fetch_remote_community( let outbox = fetch_remote_object::(client, &community.get_outbox_url()?).await?; let outbox_items = outbox.items().context(location_info!())?.clone(); - let outbox_items = outbox_items.many().context(location_info!())?; - let outbox_items = outbox_items[0..20].to_vec(); + let mut outbox_items = outbox_items.many().context(location_info!())?; + if outbox_items.len() > 20 { + outbox_items = outbox_items[0..20].to_vec(); + } for o in outbox_items { let page = PageExt::from_any_base(o)?.context(location_info!())?; let post = PostForm::from_apub(&page, client, pool, None).await?;