fix(upload): MIME по расширению, а не content_type
curl/браузеры шлют application/octet-stream — _guess_mime() не вызывался. Теперь приоритет: расширение файла > content_type
This commit is contained in:
+2
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user