Commit
·
2d57bd2
1
Parent(s):
0ee3736
add: charactors to the vaild list for chat titles
Browse files
app/lib/hooks/useEditChatDescription.ts
CHANGED
|
@@ -92,7 +92,8 @@ export function useEditChatDescription({
|
|
| 92 |
}
|
| 93 |
|
| 94 |
const lengthValid = trimmedDesc.length > 0 && trimmedDesc.length <= 100;
|
| 95 |
-
|
|
|
|
| 96 |
|
| 97 |
if (!lengthValid) {
|
| 98 |
toast.error('Description must be between 1 and 100 characters.');
|
|
@@ -100,7 +101,7 @@ export function useEditChatDescription({
|
|
| 100 |
}
|
| 101 |
|
| 102 |
if (!characterValid) {
|
| 103 |
-
toast.error('Description can only contain
|
| 104 |
return false;
|
| 105 |
}
|
| 106 |
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
const lengthValid = trimmedDesc.length > 0 && trimmedDesc.length <= 100;
|
| 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);
|
| 97 |
|
| 98 |
if (!lengthValid) {
|
| 99 |
toast.error('Description must be between 1 and 100 characters.');
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
if (!characterValid) {
|
| 104 |
+
toast.error('Description can only contain letters, numbers, spaces, and basic punctuation.');
|
| 105 |
return false;
|
| 106 |
}
|
| 107 |
|