@@ -467,7 +467,7 @@ async fn migrate_threepids(
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 many threepids for unknown users
470
+ // HACK(matrix.org): we seem to have casing inconsistencies
471
471
if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
472
472
tracing:: warn!( mxid = %synapse_user_id, "Threepid found in the database matching an MXID with the wrong casing" ) ;
473
473
continue ;
@@ -568,6 +568,12 @@ async fn migrate_external_ids(
568
568
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
569
569
. to_owned ( ) ;
570
570
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
571
+ // HACK(matrix.org): we seem to have casing inconsistencies
572
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
573
+ tracing:: warn!( mxid = %synapse_user_id, "External ID found in the database matching an MXID with the wrong casing" ) ;
574
+ continue ;
575
+ }
576
+
571
577
return Err ( Error :: MissingUserFromDependentTable {
572
578
table : "user_external_ids" . to_owned ( ) ,
573
579
user : synapse_user_id,
@@ -668,6 +674,12 @@ async fn migrate_devices(
668
674
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
669
675
. to_owned ( ) ;
670
676
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
677
+ // HACK(matrix.org): we seem to have casing inconsistencies
678
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
679
+ tracing:: warn!( mxid = %synapse_user_id, "Device found in the database matching an MXID with the wrong casing" ) ;
680
+ continue ;
681
+ }
682
+
671
683
return Err ( Error :: MissingUserFromDependentTable {
672
684
table : "devices" . to_owned ( ) ,
673
685
user : synapse_user_id,
@@ -813,6 +825,12 @@ async fn migrate_unrefreshable_access_tokens(
813
825
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
814
826
. to_owned ( ) ;
815
827
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
828
+ // HACK(matrix.org): we seem to have casing inconsistencies
829
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
830
+ tracing:: warn!( mxid = %synapse_user_id, "Access token found in the database matching an MXID with the wrong casing" ) ;
831
+ continue ;
832
+ }
833
+
816
834
return Err ( Error :: MissingUserFromDependentTable {
817
835
table : "access_tokens" . to_owned ( ) ,
818
836
user : synapse_user_id,
@@ -967,6 +985,12 @@ async fn migrate_refreshable_token_pairs(
967
985
. into_extract_localpart ( synapse_user_id. clone ( ) ) ?
968
986
. to_owned ( ) ;
969
987
let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
988
+ // HACK(matrix.org): we seem to have casing inconsistencies
989
+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
990
+ tracing:: warn!( mxid = %synapse_user_id, "Refresh token found in the database matching an MXID with the wrong casing" ) ;
991
+ continue ;
992
+ }
993
+
970
994
return Err ( Error :: MissingUserFromDependentTable {
971
995
table : "refresh_tokens" . to_owned ( ) ,
972
996
user : synapse_user_id,
0 commit comments