fix(release-cleanup): 加入分頁上限並編碼刪除 URL 路徑片段

- fetchAllPages 加入 MAX_PAGES(1000)安全斷點,避免 API 異常時無限迴圈
- 刪除 release/tag 時對 id 與 tag 名稱做 encodeURIComponent,
  防止特殊字元造成路徑穿越(正常數值/版本字串編碼後不變)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 11:21:56 +08:00
co-authored by Claude Opus 4.8
parent 49ac5d4ec4
commit aa4f6364e2
3 changed files with 11 additions and 2 deletions
+2 -1
View File
@@ -56,7 +56,8 @@ export async function cleanupReleases(client, config) {
continue
}
const url = `${config.releaseApiUrl}/${id}`
// 對 id 做編碼,避免非預期內容被拼接進 URL(防路徑穿越);正常數值 id 編碼後不變。
const url = `${config.releaseApiUrl}/${encodeURIComponent(id)}`
info(`DELETE ${tag} (${name})`)
const code = await client.deleteResource(url)