]> Untitled Git - lemmy.git/commitdiff
Fix crash in federation tests
authorFelix Ableitner <me@nutomic.com>
Fri, 14 Aug 2020 14:50:21 +0000 (16:50 +0200)
committerFelix Ableitner <me@nutomic.com>
Fri, 14 Aug 2020 14:50:21 +0000 (16:50 +0200)
server/src/apub/fetcher.rs

index d031fa1930755ae444a8b2480ec05c2f4bdb5d87..d8eaf70a7eda4142b21a710b341d26654acdba8f 100644 (file)
@@ -325,8 +325,10 @@ async fn fetch_remote_community(
   let outbox =
     fetch_remote_object::<OrderedCollection>(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?;