关于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
)

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

相关推荐
GISer_Jing1 小时前
AI自动化工作流:智能驱动未来(升级研究生项目!!!)
人工智能·前端框架·自动化
草捏子1 小时前
Agent Skills:让 AI 一次学会、永远记住的能力扩展方案
人工智能
NocoBase2 小时前
【2.0 教程】第 1 章:认识 NocoBase ,5 分钟跑起来
数据库·人工智能·开源·github·无代码
后端小肥肠2 小时前
OpenClaw实战|从识图到公众号内容自动化,我跑通了完整链路
人工智能·aigc·agent
Elastic 中国社区官方博客2 小时前
快速 vs. 准确:衡量量化向量搜索的召回率
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
qq_381338502 小时前
【技术日报】2026-03-18 AI 领域重磅速递
大数据·人工智能
NocoBase2 小时前
开源项目管理工具选型指南(2026年最新)
人工智能·开源·无代码
feasibility.2 小时前
AI 爬虫高手养成:Openclaw+Scrapling 手动部署 + 采集策略(以Walmart 电商平台为例)
人工智能·爬虫·科技·机器人·agi·openclaw·scrapling
程序员老猫2 小时前
前端菜鸡狂喜!DeepSeek+Gemini,嘴炮出完整博客方案
人工智能
AI周红伟3 小时前
周红伟:《OpenClaw安全防控:OpenClaw++Skills智能体安全部署、实操和企业应用实操》
人工智能·阿里云·云计算·腾讯云·openclaw