@@ -372,7 +372,7 @@ async fn migrate_threepids(
372
372
continue ;
373
373
} ;
374
374
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
375
- // HACK(matrix.org): we seem to have many threepids for unknown users
375
+ // HACK(matrix.org): we seem to have casing inconsistencies
376
376
if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
377
377
tracing:: warn!( mxid = %synapse_user_id, "Threepid found in the database matching an MXID with the wrong casing" ) ;
378
378
continue ;
@@ -469,6 +469,12 @@ async fn migrate_external_ids(
469
469
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
470
470
. to_owned ( ) ;
471
471
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
472
+ // HACK(matrix.org): we seem to have casing inconsistencies
473
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
474
+ tracing:: warn!( mxid = %synapse_user_id, "External ID found in the database matching an MXID with the wrong casing" ) ;
475
+ continue ;
476
+ }
477
+
472
478
return Err ( Error :: MissingUserFromDependentTable {
473
479
table : "user_external_ids" . to_owned ( ) ,
474
480
user : synapse_user_id,
@@ -560,6 +566,12 @@ async fn migrate_devices(
560
566
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
561
567
. to_owned ( ) ;
562
568
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
569
+ // HACK(matrix.org): we seem to have casing inconsistencies
570
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
571
+ tracing:: warn!( mxid = %synapse_user_id, "Device found in the database matching an MXID with the wrong casing" ) ;
572
+ continue ;
573
+ }
574
+
563
575
return Err ( Error :: MissingUserFromDependentTable {
564
576
table : "devices" . to_owned ( ) ,
565
577
user : synapse_user_id,
@@ -689,6 +701,12 @@ async fn migrate_unrefreshable_access_tokens(
689
701
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
690
702
. to_owned ( ) ;
691
703
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
704
+ // HACK(matrix.org): we seem to have casing inconsistencies
705
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
706
+ tracing:: warn!( mxid = %synapse_user_id, "Access token found in the database matching an MXID with the wrong casing" ) ;
707
+ continue ;
708
+ }
709
+
692
710
return Err ( Error :: MissingUserFromDependentTable {
693
711
table : "access_tokens" . to_owned ( ) ,
694
712
user : synapse_user_id,
@@ -834,6 +852,12 @@ async fn migrate_refreshable_token_pairs(
834
852
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
835
853
. to_owned ( ) ;
836
854
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
855
+ // HACK(matrix.org): we seem to have casing inconsistencies
856
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
857
+ tracing:: warn!( mxid = %synapse_user_id, "Refresh token found in the database matching an MXID with the wrong casing" ) ;
858
+ continue ;
859
+ }
860
+
837
861
return Err ( Error :: MissingUserFromDependentTable {
838
862
table : "refresh_tokens" . to_owned ( ) ,
839
863
user : synapse_user_id,
0 commit comments