fix: sniff chat attachment mime (#670) (thanks @cristip73)

This commit is contained in:
Peter Steinberger
2026-01-10 20:06:33 +01:00
parent c4e76eb635
commit 193ebba657
7 changed files with 131 additions and 13 deletions

View File

@@ -200,15 +200,15 @@ export const chatHandlers: GatewayRequestHandlers = {
).toString("base64")
: undefined,
}))
.filter((a) => a.content && a.mimeType) ?? [];
.filter((a) => a.content) ?? [];
let parsedMessage = p.message;
let parsedImages: ChatImageContent[] = [];
if (normalizedAttachments.length > 0) {
try {
const parsed = parseMessageWithAttachments(
const parsed = await parseMessageWithAttachments(
p.message,
normalizedAttachments,
{ maxBytes: 5_000_000 },
{ maxBytes: 5_000_000, log: context.logGateway },
);
parsedMessage = parsed.message;
parsedImages = parsed.images;

View File

@@ -32,6 +32,7 @@ export type GatewayRequestContext = {
getHealthCache: () => HealthSummary | null;
refreshHealthSnapshot: (opts?: { probe?: boolean }) => Promise<HealthSummary>;
logHealth: { error: (message: string) => void };
logGateway: { warn: (message: string) => void };
incrementPresenceVersion: () => number;
getHealthVersion: () => number;
broadcast: (