ソースを参照

an example of suppress (#24136)

tags/1.8.0
Asuka Minato 2ヶ月前
コミット
ebd2c8236d
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更2行の追加3行の削除
  1. 2
    3
      api/controllers/common/helpers.py

+ 2
- 3
api/controllers/common/helpers.py ファイルの表示

@@ -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]


読み込み中…
キャンセル
保存