This commit is contained in:
rustmailer
2026-04-21 21:23:28 +08:00
parent 51329fb2e1
commit c14834abe8
6 changed files with 90 additions and 40 deletions
+22 -1
View File
@@ -173,7 +173,28 @@ export function MailListTable({
{
accessorKey: "subject",
header: t('search.subject'),
cell: ({ row }) => <LongText className='text-xs'>{row.original.subject}</LongText>,
cell: ({ row }) => {
const tags = row.original.tags ?? [];
return (
<div className="flex flex-col gap-1 py-1.5 min-w-0">
<LongText className='text-xs font-medium truncate'>
{row.original.subject}
</LongText>
{tags.length > 0 && (
<div className="flex items-center gap-1 flex-wrap">
{tags.map((tag) => (
<span
key={tag}
className="inline-flex items-center rounded-md bg-primary/15 px-2 py-0.5 text-[10px] font-semibold text-primary ring-1 ring-inset ring-primary/20"
>
{tag}
</span>
))}
</div>
)}
</div>
);
},
meta: { className: 'text-left text-xs' }
},
{
+21 -4
View File
@@ -88,12 +88,28 @@ export function validateTag(facetPath: string) {
};
}
const invalidChars = /['"`;,()[\]{}<>]/;
if (invalidChars.test(facetPath)) {
if (!facetPath.startsWith('/')) {
return {
valid: false,
error: "Tag path contains invalid characters"
error: "Tag path must start with '/'"
};
}
let escaped = false;
for (let i = 1; i < facetPath.length; i++) {
const char = facetPath[i];
if (escaped) {
escaped = false;
} else if (char === '\\') {
escaped = true;
}
}
if (escaped) {
return {
valid: false,
error: "Tag path has unmatched escape character at the end"
};
}
@@ -101,6 +117,7 @@ export function validateTag(facetPath: string) {
}
export function formatTimestamp(milliseconds: number): string {
const date = new Date(milliseconds);
const year = date.getFullYear();