feat(ui): make sure UI shows that commas are not allowed in labels

This commit is contained in:
aaldebs99
2025-12-16 22:43:52 +00:00
parent 1c8b848852
commit 8617a7e489
2 changed files with 8 additions and 0 deletions

View File

@@ -1023,6 +1023,7 @@
"inUse": "Cannot delete label because it is currently assigned to documents. Please remove the label from all documents first.",
"systemDelete": "System labels cannot be deleted. Only user-created labels can be removed.",
"invalidName": "Label name contains invalid characters. Please use only letters, numbers, and basic punctuation.",
"commaNotAllowed": "Label names cannot contain commas.",
"invalidColor": "Invalid color format. Please use a valid hex color like #0969da.",
"maxLabelsReached": "Maximum number of labels reached. Please delete some labels before creating new ones."
}

View File

@@ -121,6 +121,13 @@ const LabelCreateDialog: React.FC<LabelCreateDialogProps> = ({
return;
}
// Disallow commas in label names (breaks comma-separated search filters)
// Also check for URL-encoded commas (%2c) which could cause issues in query parameters
if (formData.name.includes(',') || formData.name.toLowerCase().includes('%2c')) {
setNameError(t('labels.errors.commaNotAllowed'));
return;
}
setLoading(true);
try {
await onSubmit({