@@ -467,7 +467,7 @@ async fn migrate_threepids(
467467 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
468468 . to_owned ( ) ;
469469 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
471471 if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
472472 tracing:: warn!( mxid = %synapse_user_id, "Threepid found in the database matching an MXID with the wrong casing" ) ;
473473 continue ;
@@ -568,6 +568,12 @@ async fn migrate_external_ids(
568568 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
569569 . to_owned ( ) ;
570570 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+
571577 return Err ( Error :: MissingUserFromDependentTable {
572578 table : "user_external_ids" . to_owned ( ) ,
573579 user : synapse_user_id,
@@ -668,6 +674,12 @@ async fn migrate_devices(
668674 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
669675 . to_owned ( ) ;
670676 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+
671683 return Err ( Error :: MissingUserFromDependentTable {
672684 table : "devices" . to_owned ( ) ,
673685 user : synapse_user_id,
@@ -813,6 +825,12 @@ async fn migrate_unrefreshable_access_tokens(
813825 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
814826 . to_owned ( ) ;
815827 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+
816834 return Err ( Error :: MissingUserFromDependentTable {
817835 table : "access_tokens" . to_owned ( ) ,
818836 user : synapse_user_id,
@@ -967,6 +985,12 @@ async fn migrate_refreshable_token_pairs(
967985 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
968986 . to_owned ( ) ;
969987 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+
970994 return Err ( Error :: MissingUserFromDependentTable {
971995 table : "refresh_tokens" . to_owned ( ) ,
972996 user : synapse_user_id,
0 commit comments