- 更新各目录 AGENTS.md 的子目录信息 - 添加新增目录的 AGENTS.md 文件 - 更新 docs/prompts.md 添加新的提示词 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.1 KiB
1.1 KiB
mimeutil
Purpose
MIME 类型检测工具包,提供文件内容类型检测功能,补充 Go 标准库缺失或错误的 MIME 类型映射。
Key Files
| File | Description |
|---|---|
detect.go |
MIME 类型检测函数和扩展名映射表 |
detect_test.go |
检测函数单元测试 |
For AI Agents
Working In This Directory
DetectContentType(filePath)根据扩展名返回 MIME 类型- 使用包本地映射而非全局
mime.AddExtensionType,避免副作用 - 未知类型返回空字符串,调用方应使用默认值
Testing Requirements
- 运行测试:
go test ./internal/mimeutil/... - 测试覆盖扩展名大小写处理和覆盖映射
Common Patterns
contentType := mimeutil.DetectContentType(filePath)
if contentType == "" {
contentType = "application/octet-stream"
}
Dependencies
External
mime- Go 标准库 MIME 类型检测path/filepath- 扩展名提取strings- 大小写处理