关于dify中http节点下载文件时,文件名不为原始文件名问题解决

我在使用http节点下载文件时,文件名默认为UUID,于是我设置了请求头

复制代码
Content-Disposition: attachment; filename*=UTF-8''{file_name}

但是发现还是没有变化

而且我发现设置的Content-Disposition完全没有起作用,并且返回的结果本身就是原始文件名,但是并没有启用,最后files中的filename返回的还是uuid。

我在github上发现有人有相同的问题,并且已经解决

When retrieving files using the HTTP component, the file name is incorrect, including custom plugins. Including the latest version 1.7.2 · Issue #24074 · langgenius/dify

简单来说就是需要去修改后端代码,如果是docker部署就需要去docker中修改,

修改的文件为 api/core/workflow/nodes/http_request/node.py,190行左右,修改为

python 复制代码
content_disposition_filename = None
if parsed_content_disposition:
    content_disposition_filename = parsed_content_disposition.get_filename()

filename = content_disposition_filename or url.split("?")[0].split("/")[-1] or ""
# ... rest of your logic

tool_file = tool_file_manager.create_file_by_raw(
    user_id=self.user_id,
    tenant_id=self.tenant_id,
    conversation_id=None,
    file_binary=content,
    mimetype=mime_type,
    filename=filename,  # <-- pass the filename here
)

随后就可以输出原始文件名的文件了

相关推荐
大模型真好玩10 分钟前
做好真人分身却不知道拍什么?8个视频应用场景直接抄
人工智能·agent·deepseek
ZhengEnCi10 分钟前
黄仁勋想回英伟达却被拒:创始人 CEO 辞职后为什么回不来,董事会继任机制全拆解
人工智能·nvidia·团队管理
真上帝的左手20 分钟前
26. AI-大语言模型-基础
人工智能·ai·架构·llm·大语言模型
墨林陌1 小时前
AI 热点日报(2026-11-18):OpenAI 发布 GPT-6.2,APEC 峰会聚焦 AI,AI 制药融资创新高
人工智能
byte轻骑兵1 小时前
【ATT】规范精讲[8]:配置要确认、灌包要速度、多字段要原子——BLE 写入的四重选择
人工智能·aiot·l2cap·嵌入式蓝牙·蓝牙链路管理
AAA修煤气灶刘哥1 小时前
Agent 都能干活了,软件还需要那么多按钮吗?
人工智能·后端·架构
Purple Coder2 小时前
开题报告学习
人工智能
狂师2 小时前
牛逼!谷歌亲自下场开源的AI自动化神器!
人工智能·开源·测试
金融小师妹3 小时前
多因子关联模型:黄金与铜价同步回落背后的金融变量及PPI传导分析
大数据·人工智能·金融
ZhengEnCi3 小时前
中美AI竞赛之外其他国家在干什么:算力5%的欧洲、买卡的沙特与做场景的日韩
人工智能·gpu·nvidia