fix(calculate-version): 強化輸入驗證與錯誤訊息

- config 對 GITEA_REPOSITORY 加入 owner/repo 格式驗證,拒絕路徑穿越與特殊字元
- releases JSON 解析失敗時,錯誤訊息納入截斷的回傳內容片段以利除錯

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 14:01:30 +08:00
co-authored by Claude Opus 4.8
parent bde3719aad
commit b8804c5218
2 changed files with 17 additions and 3 deletions
+3 -1
View File
@@ -63,7 +63,9 @@ async function fetchReleases(baseUrl, options = {}) {
try {
pageJson = JSON.parse(text);
} catch {
throw new Error(`release API 回傳資料無法解析 (page=${page})`);
// 附上截斷的回傳內容片段,便於除錯回傳格式異常
const snippet = text.slice(0, 200);
throw new Error(`release API 回傳資料無法解析 (page=${page}): ${snippet}`);
}
if (pageJson === null) {