mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-05 20:46:43 +00:00
fix: chat title character restriction
added: characters to valid list for chat title
This commit is contained in:
commit
e064803955
@ -92,7 +92,8 @@ export function useEditChatDescription({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const lengthValid = trimmedDesc.length > 0 && trimmedDesc.length <= 100;
|
const lengthValid = trimmedDesc.length > 0 && trimmedDesc.length <= 100;
|
||||||
const characterValid = /^[a-zA-Z0-9\s]+$/.test(trimmedDesc);
|
// Allow letters, numbers, spaces, and common punctuation but exclude characters that could cause issues
|
||||||
|
const characterValid = /^[a-zA-Z0-9\s\-_.,!?()[\]{}'"]+$/.test(trimmedDesc);
|
||||||
|
|
||||||
if (!lengthValid) {
|
if (!lengthValid) {
|
||||||
toast.error('Description must be between 1 and 100 characters.');
|
toast.error('Description must be between 1 and 100 characters.');
|
||||||
@ -100,7 +101,7 @@ export function useEditChatDescription({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!characterValid) {
|
if (!characterValid) {
|
||||||
toast.error('Description can only contain alphanumeric characters and spaces.');
|
toast.error('Description can only contain letters, numbers, spaces, and basic punctuation.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user