Skip to content

Commit

Permalink
fix: http node download file always image type (#11319)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjlarry authored Dec 4, 2024
1 parent 98a1b01 commit d470e55
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions api/core/workflow/nodes/http_request/node.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import logging
from collections.abc import Mapping, Sequence
from mimetypes import guess_extension
from os import path
from typing import Any

from configs import dify_config
from core.file import File, FileTransferMethod, FileType
from core.file import File, FileTransferMethod
from core.tools.tool_file_manager import ToolFileManager
from core.workflow.entities.node_entities import NodeRunResult
from core.workflow.entities.variable_entities import VariableSelector
Expand Down Expand Up @@ -150,11 +148,6 @@ def extract_files(self, url: str, response: Response) -> list[File]:
content = response.content

if is_file and content_type:
# extract filename from url
filename = path.basename(url)
# extract extension if possible
extension = guess_extension(content_type) or ".bin"

tool_file = ToolFileManager.create_file_by_raw(
user_id=self.user_id,
tenant_id=self.tenant_id,
Expand All @@ -165,7 +158,6 @@ def extract_files(self, url: str, response: Response) -> list[File]:

mapping = {
"tool_file_id": tool_file.id,
"type": FileType.IMAGE.value,
"transfer_method": FileTransferMethod.TOOL_FILE.value,
}
file = file_factory.build_from_mapping(
Expand Down

0 comments on commit d470e55

Please sign in to comment.