Skip to content

Commit

Permalink
fix: chat title character restriction
Browse files Browse the repository at this point in the history
added: characters to valid list for chat title
  • Loading branch information
dustinwloring1988 authored Dec 17, 2024
2 parents fce8999 + 2d57bd2 commit e064803
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/lib/hooks/useEditChatDescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,16 @@ export function useEditChatDescription({
}

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) {
toast.error('Description must be between 1 and 100 characters.');
return false;
}

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;
}

Expand Down

0 comments on commit e064803

Please sign in to comment.