Skip to content

Commit 0ac5920

Browse files
committed
Handle AS users with invalid localparts edge case
1 parent 48176a6 commit 0ac5920

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
@@ -170,6 +170,14 @@ async fn migrate_users(
170170

171171
while let Some(user_res) = users_stream.next().await {
172172
let user = user_res.into_synapse("reading user")?;
173+
174+
// Handling an edge case: some AS users may have invalid localparts containing
175+
// extra `:` characters. These users are ignored and a warning is logged.
176+
if user.appservice_id.is_some() && user.name.0.chars().filter(|c| *c == ':').count() > 1 {
177+
tracing::warn!("AS user {} has invalid localpart, ignoring!", user.name.0);
178+
continue;
179+
}
180+
173181
let (mas_user, mas_password_opt) = transform_user(&user, &state.server_name, rng)?;
174182

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

0 commit comments

Comments
 (0)