fix(upload): MIME по расширению, а не content_type

curl/браузеры шлют application/octet-stream — _guess_mime() не вызывался.
Теперь приоритет: расширение файла > content_type
This commit is contained in:
2026-06-14 06:52:37 +04:00
parent 4635ed4c57
commit db2f6cc6f1
+2 -2
View File
@@ -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: