Files
Toju/toju-app/src/app/domains/attachment/domain/logic/attachment-normalize.rules.ts
T
myxeliumandCursor 0078c320a5 fix: Bug - Sending files and attachment issues
Normalize attachment MIME types from filenames, hydrate playable media and
gallery tiles from disk without redundant peer requests, reset stalled partial
downloads, and improve gallery retry/hydration UX across chat and DMs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 13:30:13 +02:00

18 lines
491 B
TypeScript

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