Files
accounted/extensions/general/whatsapp-inbox/lib/chat-mime.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

21 lines
792 B
TypeScript

/**
* Chat intake accepts what phones actually produce. Narrower than the upload
* allowlist on purpose: WhatsApp transcodes photos to JPEG, so HEIC never
* arrives, and everything else gets the M15 nudge.
*
* Lives in its own dependency-free module because both the deferred worker
* (the M15 rejection) and the webhook (the instant checkmark reaction) gate
* on it, and tests that mock process-inbound must not lose the constant.
*/
export const CHAT_ALLOWED_MIME_TYPES: ReadonlySet<string> = new Set([
'image/jpeg',
'image/png',
'image/webp',
'application/pdf',
])
/** Normalize a raw MIME header value to what the allowlist stores. */
export function normalizeChatMime(mime: string | null | undefined): string {
return (mime ?? '').split(';')[0].trim().toLowerCase()
}