From 984b9e812322d49cb36cdb28ccbb822d3eb13f38 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 1 Oct 2026 17:43:53 +0300 Subject: [PATCH] Keep PM attachment kinds scoped to files voice and video --- src/media_async/attachment.c | 5 ++--- src/media_async/attachment.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/media_async/attachment.c b/src/media_async/attachment.c index f59c1de7..e524d37f 100644 --- a/src/media_async/attachment.c +++ b/src/media_async/attachment.c @@ -38,9 +38,9 @@ int attachment_validate(const struct attachment_info* info) { if (wave) goto invalid; if (info->kind == ATTACHMENT_FILE) { if (info->duration_ms || info->width || info->height) goto invalid; - } else if (info->kind == ATTACHMENT_VIDEO || info->kind == ATTACHMENT_IMAGE) { + } else if (info->kind == ATTACHMENT_VIDEO) { if (!info->width || !info->height || info->width > 16384 || info->height > 16384) goto invalid; - if (info->kind == ATTACHMENT_VIDEO ? (!info->duration_ms || info->duration_ms > 86400000) : info->duration_ms) goto invalid; + if (!info->duration_ms || info->duration_ms > 86400000) goto invalid; } else goto invalid; } return 0; @@ -81,7 +81,6 @@ const char* attachment_content_type(enum attachment_kind kind) { switch (kind) { case ATTACHMENT_VOICE: return "audio/opus"; case ATTACHMENT_VIDEO: return "video/mp4"; - case ATTACHMENT_IMAGE: return "image/jpeg"; default: return "application/octet-stream"; } } diff --git a/src/media_async/attachment.h b/src/media_async/attachment.h index 65ba2ede..f0342d91 100644 --- a/src/media_async/attachment.h +++ b/src/media_async/attachment.h @@ -9,7 +9,7 @@ extern "C" { #endif -enum attachment_kind { ATTACHMENT_FILE = 1, ATTACHMENT_VOICE, ATTACHMENT_VIDEO, ATTACHMENT_IMAGE }; +enum attachment_kind { ATTACHMENT_FILE = 1, ATTACHMENT_VOICE, ATTACHMENT_VIDEO }; #define ATTACHMENT_WAVE_SIZE 100 #define ATTACHMENT_WIRE_MAX (11 + 255 + ATTACHMENT_WAVE_SIZE) struct attachment_info {