Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
docs(message): state the real bound the inline-media allowance creates
Yudhi Armyndharisf665bdb45ac0
diff --git a/.env.example b/.env.exampleindex 1d412214d..ebff7a279 100644--- a/.env.example+++ b/.env.example@@ -426,7 +426,10 @@ WEBHOOK_SSRF_PROTECT=true# (GET /sessions/:id/messages and the MCP MessageList tool). The row count is clamped to# 1..100, but a row is not a bounded object: past the budget each payload is replaced with# the { omitted: true, sizeBytes } marker and stays fetchable from the per-message media-# route. 0 omits every payload. Default: 8 MiB of encoded base64.+# route. The NEWEST payload is always sent whatever its size — otherwise a single photo larger+# than the budget could never be read back — so the real bound is max(this, one payload), and one+# payload is capped upstream by MEDIA_DOWNLOAD_MAX_BYTES. 0 omits every payload, newest included.+# Default: 8 MiB of encoded base64.# MESSAGE_LIST_INLINE_MEDIA_BUDGET_BYTES=8388608# STORE_EPHEMERAL_MESSAGES=true # Set to false to skip persisting and dispatching incoming# # WhatsApp disappearing messages (ephemeralDuration > 0).diff --git a/src/modules/message/message.service.ts b/src/modules/message/message.service.tsindex ebce10fee..03e424fad 100644--- a/src/modules/message/message.service.ts+++ b/src/modules/message/message.service.ts@@ -44,6 +44,12 @@ export const DEFAULT_TEMPLATE_RENDER_MAX_CHARS = 64 * 1024;* holds the whole base64 payload, so a hundred media rows serialise to hundreds of megabytes — past* V8's string ceiling the read fails outright, and the dashboard requests the maximum page size with* no way to ask for less. Mirrors the export path's budget rather than inventing a second policy.+ *+ * NOT a hard ceiling on the response. The newest payload is let through whatever its size (see+ * spendInlineMediaBudget), so the real bound is `max(budget, one payload)` — and one payload is+ * bounded upstream by `capInboundMedia` at MEDIA_DOWNLOAD_MAX_BYTES (50 MiB by default, ~68 MiB once+ * base64-encoded). That is well inside V8's string ceiling and is the point: the alternative is a+ * large photo no client can ever read back. Raising MEDIA_DOWNLOAD_MAX_BYTES raises this too.*/export const DEFAULT_MESSAGE_LIST_INLINE_MEDIA_BUDGET_BYTES = 8 * 1024 * 1024;