소스 검색

enhance guessing mimetype of tool file (#17640)

tags/1.3.0
Qun 6 달 전
부모
커밋
0e136b42a2
No account linked to committer's email address
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5
    1
      api/core/tools/tool_file_manager.py

+ 5
- 1
api/core/tools/tool_file_manager.py 파일 보기

@@ -108,7 +108,11 @@ class ToolFileManager:
except httpx.TimeoutException:
raise ValueError(f"timeout when downloading file from {file_url}")

mimetype = guess_type(file_url)[0] or "application/octet-stream"
mimetype = (
guess_type(file_url)[0]
or response.headers.get("Content-Type", "").split(";")[0].strip()
or "application/octet-stream"
)
extension = guess_extension(mimetype) or ".bin"
unique_name = uuid4().hex
filename = f"{unique_name}{extension}"

Loading…
취소
저장