File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -55,23 +55,24 @@ function useNameErrorString({
5555 isPublic : boolean ;
5656 isMe : boolean ;
5757} ) {
58+ const byteLength = new TextEncoder ( ) . encode ( newName ) . length ;
5859 if ( isMe ) {
5960 return ! newName
6061 ? tr ( 'displayNameErrorDescription' )
61- : newName . length > LIBSESSION_CONSTANTS . CONTACT_MAX_NAME_LENGTH
62+ : byteLength > LIBSESSION_CONSTANTS . CONTACT_MAX_NAME_LENGTH
6263 ? tr ( 'displayNameErrorDescriptionShorter' )
6364 : '' ;
6465 }
6566 if ( isPublic ) {
6667 return ! newName
6768 ? tr ( 'communityNameEnterPlease' )
68- : newName . length > LIBSESSION_CONSTANTS . BASE_GROUP_MAX_NAME_LENGTH
69+ : byteLength > LIBSESSION_CONSTANTS . BASE_GROUP_MAX_NAME_LENGTH
6970 ? tr ( 'updateCommunityInformationEnterShorterName' )
7071 : '' ;
7172 }
7273 return ! newName
7374 ? tr ( 'groupNameEnterPlease' )
74- : newName . length > LIBSESSION_CONSTANTS . BASE_GROUP_MAX_NAME_LENGTH
75+ : byteLength > LIBSESSION_CONSTANTS . BASE_GROUP_MAX_NAME_LENGTH
7576 ? tr ( 'groupNameEnterShorter' )
7677 : '' ;
7778}
@@ -94,7 +95,9 @@ function useDescriptionErrorString({
9495 // description is always optional
9596 return '' ;
9697 }
97- if ( newDescription . length <= LIBSESSION_CONSTANTS . GROUP_INFO_DESCRIPTION_MAX_LENGTH ) {
98+ const byteLength = new TextEncoder ( ) . encode ( newDescription ) . length ;
99+
100+ if ( byteLength <= LIBSESSION_CONSTANTS . GROUP_INFO_DESCRIPTION_MAX_LENGTH ) {
98101 return '' ;
99102 }
100103 return isPublic
You can’t perform that action at this time.
0 commit comments