Skip to content

Commit 2d57bd2

Browse files
add: charactors to the vaild list for chat titles
added common punctuation to the charactersValid
1 parent 0ee3736 commit 2d57bd2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/lib/hooks/useEditChatDescription.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,16 @@ export function useEditChatDescription({
9292
}
9393

9494
const lengthValid = trimmedDesc.length > 0 && trimmedDesc.length <= 100;
95-
const characterValid = /^[a-zA-Z0-9\s]+$/.test(trimmedDesc);
95+
// Allow letters, numbers, spaces, and common punctuation but exclude characters that could cause issues
96+
const characterValid = /^[a-zA-Z0-9\s\-_.,!?()[\]{}'"]+$/.test(trimmedDesc);
9697

9798
if (!lengthValid) {
9899
toast.error('Description must be between 1 and 100 characters.');
99100
return false;
100101
}
101102

102103
if (!characterValid) {
103-
toast.error('Description can only contain alphanumeric characters and spaces.');
104+
toast.error('Description can only contain letters, numbers, spaces, and basic punctuation.');
104105
return false;
105106
}
106107

0 commit comments

Comments
 (0)