fix: enforce telegram shared outbound chunking

This commit is contained in:
Ayaan Zaidi
2026-02-28 07:58:46 +05:30
committed by Ayaan Zaidi
parent 4221b5f809
commit 69c39368ec
4 changed files with 91 additions and 6 deletions

View File

@@ -40,6 +40,7 @@ export type { NormalizedOutboundPayload } from "./payloads.js";
export { normalizeOutboundPayloads } from "./payloads.js";
const log = createSubsystemLogger("outbound/deliver");
const TELEGRAM_TEXT_LIMIT = 4096;
type SendMatrixMessage = (
to: string,
@@ -314,11 +315,15 @@ async function deliverOutboundPayloadsCore(
silent: params.silent,
mediaLocalRoots,
});
const textLimit = handler.chunker
const configuredTextLimit = handler.chunker
? resolveTextChunkLimit(cfg, channel, accountId, {
fallbackLimit: handler.textChunkLimit,
})
: undefined;
const textLimit =
channel === "telegram" && typeof configuredTextLimit === "number"
? Math.min(configuredTextLimit, TELEGRAM_TEXT_LIMIT)
: configuredTextLimit;
const chunkMode = handler.chunker ? resolveChunkMode(cfg, channel, accountId) : "length";
const isSignalChannel = channel === "signal";
const signalTableMode = isSignalChannel