@@ -372,7 +372,7 @@ async fn migrate_threepids(
372372 continue ;
373373 } ;
374374 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
376376 if state. users . contains_key ( username. to_lowercase ( ) . as_str ( ) ) {
377377 tracing:: warn!( mxid = %synapse_user_id, "Threepid found in the database matching an MXID with the wrong casing" ) ;
378378 continue ;
@@ -469,6 +469,12 @@ async fn migrate_external_ids(
469469 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
470470 . to_owned ( ) ;
471471 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+
472478 return Err ( Error :: MissingUserFromDependentTable {
473479 table : "user_external_ids" . to_owned ( ) ,
474480 user : synapse_user_id,
@@ -560,6 +566,12 @@ async fn migrate_devices(
560566 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
561567 . to_owned ( ) ;
562568 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+
563575 return Err ( Error :: MissingUserFromDependentTable {
564576 table : "devices" . to_owned ( ) ,
565577 user : synapse_user_id,
@@ -689,6 +701,12 @@ async fn migrate_unrefreshable_access_tokens(
689701 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
690702 . to_owned ( ) ;
691703 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+
692710 return Err ( Error :: MissingUserFromDependentTable {
693711 table : "access_tokens" . to_owned ( ) ,
694712 user : synapse_user_id,
@@ -834,6 +852,12 @@ async fn migrate_refreshable_token_pairs(
834852 . into_extract_localpart ( synapse_user_id. clone ( ) ) ?
835853 . to_owned ( ) ;
836854 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+
837861 return Err ( Error :: MissingUserFromDependentTable {
838862 table : "refresh_tokens" . to_owned ( ) ,
839863 user : synapse_user_id,
0 commit comments