Commit 7f7b4cf
committed
chore(docs-history): CR - 路径校验/错误状态/头像兜底/类型解耦
Copilot CR #279:
- route: 新增 normalizeDocsPath 做路径校验,只允许 app/docs/ 下相对路径,
拒绝 ..、反斜杠、null 字节,消除 SSRF 风险
- route: 接受 'docs/...' 和 '/docs/...' 形式,统一补成仓库根相对 'app/docs/...'
- route: 403 用 x-ratelimit-remaining 区分限流 vs 权限不足,401 单独处理
- route: author 为 null 时 avatarUrl 返回空串而不是拼 github.com/<name>.png 容易 404
- 类型 HistoryItem 抽到 app/types/docs-history.ts,解耦 client 组件与 route handler
- DocHistoryPanel: path 变化先清空 items/error 避免 '错误 + 旧列表' 同时显示
- DocHistoryPanel: 空头像用 data URI 占位防 Image 报错1 parent 890b3a7 commit 7f7b4cf
2 files changed
Lines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| 58 | + | |
51 | 59 | | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
56 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
| |||
103 | 115 | | |
104 | 116 | | |
105 | 117 | | |
106 | | - | |
| 118 | + | |
107 | 119 | | |
108 | 120 | | |
109 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments