Skip to content

文件名含非 ASCII 字符时 workspace API 返回 500 #362

@baryhuang

Description

@baryhuang

找到根因了。

问题:文件名含非 ASCII 字符时 workspace API 返回 500

测试结果(直接 curl GET /v1/files/{id}?network=...):

文件名 HTTP
regulatory_cost_overview.txt 200 ✓
New_Recording_143-transcript.txt 200 ✓
04-23 Team Meeting_ Task Management... Product Rebranding-transcript.txt 200 ✓
All Mentor Matic Mentors (1).csv 200 ✓
Business Model Canvas - Strategyzer - v2.1.pdf 200 ✓
04-24 会议记录:QModel品牌...-transcript.txt 500 ✗
04-23 团队周会:任务管理优化...-transcript.txt 500 ✗
04-22 Coaching Session_ ... — CarMomo-transcript.txt 500 ✗(em-dash "—")

规律:文件名里含 CJK 字符或 em-dash()的全部 500;纯 ASCII 文件名全部 200。 内容里有中文没问题(New_Recording_143-transcript.txt 是中文录音 52KB,读得出来)。

根因(服务端 bug)

https://workspace-endpoint.openagents.org/v1/files/{fileId} 在生成响应时拿原始 filename 去拼 header(大概率是 Content-Disposition: attachment; filename=...)。HTTP header 只允许 Latin-1,非 ASCII 字符直接让后端崩,返回裸 500 Internal Server Error(body 只有 21 字节,不是正常 JSON)。

正规做法是 RFC 5987:filename*=UTF-8''%E4%BC%9A%E8%AE%AE...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions