@@ -53,8 +53,8 @@ export const LookupMenu: React.FC<LookupMenuProps> = (
5353 ( args : UpdateUserArguments ) => {
5454 const { userCkey, userDiscordId } = args ;
5555 setLoading ( true ) ;
56- const re = / [ \\ ^ ] | [ ^ a - z 0 - 9 @ ] / g;
57- const userCkeyChecked = userCkey ?. toLowerCase ( ) . replace ( re , "" ) ;
56+ const re = / [ ^ a - z 0 - 9 @ ] / g;
57+ const userCkeyChecked = userCkey ?. trim ( ) . toLowerCase ( ) . replace ( re , "" ) ;
5858 callApi (
5959 userCkeyChecked
6060 ? `/User?ckey=${ userCkeyChecked } `
@@ -92,10 +92,11 @@ export const LookupMenu: React.FC<LookupMenuProps> = (
9292
9393 if ( ! potentialUser ) return ;
9494
95- const re = / [ \\ ^ ] | [ ^ a - z 0 - 9 @ ] / g;
96- const checked = potentialUser . toLowerCase ( ) . replace ( re , "" ) ;
95+ const re = / [ ^ a - z 0 - 9 @ ] / g;
96+ const checked = potentialUser . trim ( ) . toLowerCase ( ) . replace ( re , "" ) ;
97+ if ( ! checked ) return ;
9798
98- if ( potentialUser && ( ! userData || userData . ckey !== checked ) ) {
99+ if ( ! userData || userData . ckey !== checked ) {
99100 updateUser ( { userCkey : potentialUser as string } ) ;
100101 }
101102 } , [ value , userData , discordId , updateUser , potentialUser , user , loading ] ) ;
@@ -1216,7 +1217,9 @@ const KnownAltsModal = (props: { player: Player }) => {
12161217 if ( ! player . ckey || ! newAltCkey . trim ( ) ) return ;
12171218
12181219 const playerCkey = altsData ?. mainAccount || player . ckey ;
1219- const altCkey = newAltCkey . trim ( ) . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 @ ] / g, "" ) ;
1220+ const re = / [ ^ a - z 0 - 9 @ ] / g;
1221+ const altCkey = newAltCkey . trim ( ) . toLowerCase ( ) . replace ( re , "" ) ;
1222+ if ( ! altCkey ) return ;
12201223
12211224 callApi ( "/User/KnownAlts" , {
12221225 method : "POST" ,
0 commit comments