Skip to content

Commit 20a28ee

Browse files
committed
Handle AS users with invalid localparts edge case
1 parent ea41d68 commit 20a28ee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/syn2mas/src/migration.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ async fn migrate_users(
181181

182182
while let Some(user_res) = users_stream.next().await {
183183
let user = user_res.into_synapse("reading user")?;
184+
185+
// Handling an edge case: some AS users may have invalid localparts containing
186+
// extra `:` characters. These users are ignored and a warning is logged.
187+
if user.appservice_id.is_some() && user.name.0.chars().filter(|c| *c == ':').count() > 1 {
188+
tracing::warn!("AS user {} has invalid localpart, ignoring!", user.name.0);
189+
continue;
190+
}
191+
184192
let (mas_user, mas_password_opt) = transform_user(&user, &state.server_name, rng)?;
185193

186194
let mut flags = UserFlags::empty();

0 commit comments

Comments
 (0)