diff --git a/src/chat/chat_attachment.c b/src/chat/chat_attachment.c index a6babc9e..5b3a51dc 100644 --- a/src/chat/chat_attachment.c +++ b/src/chat/chat_attachment.c @@ -198,7 +198,7 @@ static void ak_file_done(void* arg, int error) { int chat_attachment_send(struct UTUN_INSTANCE* inst, const char* channel, const char* source, const struct attachment_info* info, const char* type, const uint8_t reply[32], uint64_t request) { if (!inst || !CC(inst) || CC(inst)->attachment_closing || !inst->media_async || !ak_channel(channel) || - !source || strlen(source) >= 1024 || !type || strlen(type) >= 32 || attachment_validate(info)) { + !source || strlen(source) >= 1024 || encrypted_file_validate_type(type) || attachment_validate(info)) { DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "attachment keys: invalid send arguments/state"); return -1; } struct ak_file* job = u_calloc(1, sizeof(*job)); diff --git a/src/chat/chat_attachment.h b/src/chat/chat_attachment.h index 8a945d98..74da8663 100644 --- a/src/chat/chat_attachment.h +++ b/src/chat/chat_attachment.h @@ -28,6 +28,7 @@ void chat_attachment_destroy(struct UTUN_INSTANCE* inst); /* Асинхронно отправить подготовленный файл; channel — десятичный ID, reply — 32 байта ID ответа либо нули. * Аргументы копируются. 0 — задача принята, source передан задаче и будет удалён даже при ошибке подготовки. * -1 — отказ запуска, source остаётся у вызывающего. Ненулевой request возвращается в CHAT_EVT_MSG_SUBMITTED. */ +/* type проверяется encrypted_file_validate_type до выделения задачи, генерации UUID/ключа и записи в БД. */ int chat_attachment_send(struct UTUN_INSTANCE* inst, const char* channel, const char* source, const struct attachment_info* info, const char* type, const uint8_t reply[32], uint64_t request);