From 2b64fcebf8ef0425575eafa452caae2450a8c7d3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 31 Mar 2026 23:17:53 +0300 Subject: immich-export: fix null nextPage causing silent exit on last page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the API returns null for nextPage, Python's .get('nextPage','') still returns None (key exists), and print(None) yields "None" — a non-empty string. The loop then tried to fetch page "None", curl failed, and set -e killed the script silently. Use 'or ""' to coerce None to empty string. Co-Authored-By: Claude Sonnet 4.6 --- scripts/immich-export | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/immich-export') diff --git a/scripts/immich-export b/scripts/immich-export index 8952e0e..2d39615 100755 --- a/scripts/immich-export +++ b/scripts/immich-export @@ -44,8 +44,10 @@ d = json.load(sys.stdin) for item in d['assets']['items']: print(item['id'] + '\t' + item['originalFileName']) " + # Use 'or ""' to handle null nextPage — .get() returns None when the key + # exists with a JSON null value, and print(None) would yield "None" (non-empty). local next_page - next_page=$(echo "$response" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['assets'].get('nextPage',''))") + next_page=$(echo "$response" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['assets'].get('nextPage') or '')") echo " Discovery: page $page done..." >&2 [[ -z "$next_page" ]] && break -- cgit v1.2.3