import { isImageAttachment } from './attachment-image.rules'; import { resolveAttachmentMime } from './attachment-mime.rules'; import type { AttachmentMeta } from '../models/attachment.model'; export function normalizeAttachmentMeta(meta: T): T { const mime = resolveAttachmentMime(meta.filename, meta.mime); return { ...meta, mime, isImage: isImageAttachment({ filename: meta.filename, isImage: meta.isImage, mime }) }; }