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