Skip to content

Commit bec4d05

Browse files
committed
fix(ui): don't treat numeric usernames as phone numbers
1 parent c5fd14c commit bec4d05

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

packages/ui/src/utils/__tests__/formatSafeIdentifier.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe('formatSafeIdentifier', () => {
88
['h***@***.com', 'h***@***.com'],
99
['username', 'username'],
1010
['u***e', 'u***e'],
11+
['4082182256', '4082182256'],
1112
['+71111111111', '+7 111 111-11-11'],
1213
['+791*******1', '+791*******1'],
1314
];

packages/ui/src/utils/formatSafeIdentifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const isMaskedIdentifier = (str: string | undefined | null) => str && str
88
* Refer to the tests for examples.
99
*/
1010
export const formatSafeIdentifier = (str: string | undefined | null) => {
11-
if (!str || str.includes('@') || isMaskedIdentifier(str) || str.match(/[a-zA-Z]/)) {
11+
if (!str || str.includes('@') || isMaskedIdentifier(str) || str.match(/[a-zA-Z]/) || !str.startsWith('+')) {
1212
return str;
1313
}
1414
return stringToFormattedPhoneString(str);

0 commit comments

Comments
 (0)