Merge pull request 'fix: fix: forge_api_paginate crashes on invalid JSON response (#194)' (#203) from fix/issue-194-1 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

This commit is contained in:
dev-qwen 2026-04-05 07:19:17 +00:00
commit a5c2ef1d99

View file

@ -227,7 +227,8 @@ forge_api_all() {
page=1 page=1
while true; do while true; do
page_items=$(forge_api GET "${path_prefix}${sep}limit=50&page=${page}") page_items=$(forge_api GET "${path_prefix}${sep}limit=50&page=${page}")
count=$(printf '%s' "$page_items" | jq 'length') count=$(printf '%s' "$page_items" | jq 'length' 2>/dev/null) || count=0
[ -z "$count" ] && count=0
[ "$count" -eq 0 ] && break [ "$count" -eq 0 ] && break
all_items=$(printf '%s\n%s' "$all_items" "$page_items" | jq -s 'add') all_items=$(printf '%s\n%s' "$all_items" "$page_items" | jq -s 'add')
[ "$count" -lt 50 ] && break [ "$count" -lt 50 ] && break