fix(matrix): block outbound media when maxMediaBytes is zero

This commit is contained in:
Alexander Minges
2026-02-11 10:57:00 +01:00
parent a28ae51ce9
commit d4d87bb4e5
2 changed files with 32 additions and 1 deletions

View File

@@ -496,7 +496,15 @@ class MatrixChannel(BaseChannel):
)
return MATRIX_ATTACHMENT_UPLOAD_FAILED_TEMPLATE.format(filename)
if limit_bytes and size_bytes > limit_bytes:
if limit_bytes <= 0:
logger.warning(
"Matrix outbound attachment skipped: media limit {} blocks all uploads for {}",
limit_bytes,
resolved,
)
return MATRIX_ATTACHMENT_TOO_LARGE_TEMPLATE.format(filename)
if size_bytes > limit_bytes:
logger.warning(
"Matrix outbound attachment skipped: {} bytes exceeds limit {} for {}",
size_bytes,