@@ -369,7 +369,7 @@ async fn migrate_threepids(
369369 continue ;
370370 } ;
371371 let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
372- // HACK(matrix.org): we seem to have many threepids for unknown users
372+ // HACK(matrix.org): we seem to have casing inconsistencies
373373 if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
374374 tracing:: warn!( mxid = %synapse_user_id, "Threepid found in the database matching an MXID with the wrong casing" ) ;
375375 continue ;
@@ -464,6 +464,12 @@ async fn migrate_external_ids(
464464 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
465465 . to_owned ( ) ;
466466 let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
467+ // HACK(matrix.org): we seem to have casing inconsistencies
468+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
469+ tracing:: warn!( mxid = %synapse_user_id, "External ID found in the database matching an MXID with the wrong casing" ) ;
470+ continue ;
471+ }
472+
467473 return Err ( Error :: MissingUserFromDependentTable {
468474 table : "user_external_ids" . to_owned ( ) ,
469475 user : synapse_user_id,
@@ -555,6 +561,12 @@ async fn migrate_devices(
555561 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
556562 . to_owned ( ) ;
557563 let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
564+ // HACK(matrix.org): we seem to have casing inconsistencies
565+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
566+ tracing:: warn!( mxid = %synapse_user_id, "Device found in the database matching an MXID with the wrong casing" ) ;
567+ continue ;
568+ }
569+
558570 return Err ( Error :: MissingUserFromDependentTable {
559571 table : "devices" . to_owned ( ) ,
560572 user : synapse_user_id,
@@ -684,6 +696,12 @@ async fn migrate_unrefreshable_access_tokens(
684696 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
685697 . to_owned ( ) ;
686698 let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
699+ // HACK(matrix.org): we seem to have casing inconsistencies
700+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
701+ tracing:: warn!( mxid = %synapse_user_id, "Access token found in the database matching an MXID with the wrong casing" ) ;
702+ continue ;
703+ }
704+
687705 return Err ( Error :: MissingUserFromDependentTable {
688706 table : "access_tokens" . to_owned ( ) ,
689707 user : synapse_user_id,
@@ -827,6 +845,12 @@ async fn migrate_refreshable_token_pairs(
827845 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
828846 . to_owned ( ) ;
829847 let Some ( user_infos) = state. users . get ( username. as_str ( ) ) . copied ( ) else {
848+ // HACK(matrix.org): we seem to have casing inconsistencies
849+ if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
850+ tracing:: warn!( mxid = %synapse_user_id, "Refresh token found in the database matching an MXID with the wrong casing" ) ;
851+ continue ;
852+ }
853+
830854 return Err ( Error :: MissingUserFromDependentTable {
831855 table : "refresh_tokens" . to_owned ( ) ,
832856 user : synapse_user_id,
0 commit comments