Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/syn2mas/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ async fn migrate_devices(
// As we're using a real IP type in the MAS database, it is possible
// that we encounter invalid IP addresses in the Synapse database.
// In that case, we should ignore them, but still log a warning.
let last_active_ip = ip.and_then(|ip| {
// One special case: Synapse will record '-' as IP in some cases, we don't want
// to log about those
let last_active_ip = ip.filter(|ip| ip != "-").and_then(|ip| {
ip.parse()
.map_err(|e| {
tracing::warn!(
Expand Down
4 changes: 2 additions & 2 deletions crates/syn2mas/src/synapse_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl FullUserId {
return Err(ExtractLocalpartError::NoAtSigil);
};

let Some((localpart, server_name)) = without_sigil.split_once(':') else {
let Some((localpart, server_name)) = without_sigil.rsplit_once(':') else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different from Synapse's splitting logic (see below refs) and moreover would break on @user:localhost:4242...

If we have truly broken user IDs in the m.org DB then .... maybe it'd be best to find a way to exorcise the database of those :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I reverted this for now; the problematic user on matrix.org is an AS one, and has no 3pid or device, so I'll do a proper fix to ignore this user once the PR to read AS users lands

return Err(ExtractLocalpartError::NoSeparator);
};

Expand Down Expand Up @@ -416,7 +416,7 @@ impl<'conn> SynapseReader<'conn> {
SELECT
user_id, device_id, display_name, last_seen, ip, user_agent
FROM devices
WHERE NOT hidden
WHERE NOT hidden AND device_id != 'guest_device'
",
)
.fetch(&mut *self.txn)
Expand Down
Loading