fix: исправить приоритет проверки размера и добавить Idempotency-Key в тесты

Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
This commit is contained in:
Evgeny Bushkov
2026-11-06 16:59:00 +03:00
co-authored by aider
parent 0d58963bc3
commit 51f98e526e
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -114,6 +114,8 @@ async def read_upload(stream, declared_mime: str) -> tuple[bytes, str, str]:
continue
buf.extend(chunk)
hasher.update(chunk)
# Лимит размера приоритетнее валидации содержимого: контракт
# требует 413 при превышении bytes, даже если заголовок битый.
if len(buf) > limit:
raise ApiError(413, "payload_too_large", "Файл больше 10 MiB")
if not header_checked and len(buf) >= _HEADER_BYTES: