From 742c769014894ec845c29c73c2cb65bf45f293e2 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 27 Mar 2024 04:36:46 +0100 Subject: [PATCH] fix: filter out empty targets --- src/server.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index 14e514d7..1f8806c5 100644 --- a/src/server.rs +++ b/src/server.rs @@ -153,7 +153,8 @@ impl Context { pub async fn address_to(&self, aid: &str, oid: Option<&str>, targets: &[String]) -> Result<(), DbErr> { let addressings : Vec = targets .iter() - .filter(|x| !x.ends_with("/followers")) + .filter(|to| !to.is_empty()) + .filter(|to| !to.ends_with("/followers")) .map(|to| model::addressing::ActiveModel { id: sea_orm::ActiveValue::NotSet, server: Set(Context::server(to)), @@ -176,6 +177,7 @@ impl Context { pub async fn deliver_to(&self, aid: &str, from: &str, targets: &[String]) -> Result<(), DbErr> { let deliveries : Vec = targets .iter() + .filter(|to| !to.is_empty()) .filter(|to| Context::server(to) != self.base()) .filter(|to| to != &PUBLIC_TARGET) .map(|to| model::delivery::ActiveModel {