fix: resolve merge conflict between Features removal and validation enhancement (#24150)

This commit is contained in:
lyzno1
2025-08-19 13:47:38 +08:00
committed by GitHub
parent f7bb3b852a
commit aacea166d7
224 changed files with 8473 additions and 1077 deletions

View File

@ -1,3 +1,4 @@
import contextlib
import mimetypes
import os
import platform
@ -65,10 +66,8 @@ def guess_file_info_from_response(response: httpx.Response):
# Use python-magic to guess MIME type if still unknown or generic
if mimetype == "application/octet-stream" and magic is not None:
try:
with contextlib.suppress(magic.MagicException):
mimetype = magic.from_buffer(response.content[:1024], mime=True)
except magic.MagicException:
pass
extension = os.path.splitext(filename)[1]