Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

an example of suppress (#24136)

Asuka Minatoebd2c8236d8d
diff --git a/api/controllers/common/helpers.py b/api/controllers/common/helpers.py
index 008f1f0f7a1..6a5197635e5 100644
--- a/api/controllers/common/helpers.py
+++ b/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]