From db2f6cc6f13b666b2249e9144e29172705079b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sun, 14 Jun 2026 06:52:37 +0400 Subject: [PATCH] =?UTF-8?q?fix(upload):=20MIME=20=D0=BF=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D0=B8=D1=8E,=20?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=20content=5Ftype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit curl/браузеры шлют application/octet-stream — _guess_mime() не вызывался. Теперь приоритет: расширение файла > content_type --- site/upload.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/upload.py b/site/upload.py index 318ad1b..660f7dc 100644 --- a/site/upload.py +++ b/site/upload.py @@ -38,9 +38,9 @@ def upload(): if not file.filename: return jsonify({"error": "empty filename"}), 400 - # 2. Определить MIME-тип + # 2. Определить MIME-тип (приоритет: расширение, а не content_type от браузера) filename = file.filename - mime_type = file.content_type or _guess_mime(filename) + mime_type = _guess_mime(filename) or file.content_type or "application/octet-stream" file_bytes = file.read() if not file_bytes: