summaryrefslogtreecommitdiff
path: root/scripts/immich-export
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-31 23:17:53 +0300
committerPaul Buetow <paul@buetow.org>2026-03-31 23:17:53 +0300
commit2b64fcebf8ef0425575eafa452caae2450a8c7d3 (patch)
treed013691c13c9bf91d8f122b7b403741e643b77ff /scripts/immich-export
parent415e12a61f0270ae7048b2e79ad04cb02ea58baa (diff)
immich-export: fix null nextPage causing silent exit on last page
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 <noreply@anthropic.com>
Diffstat (limited to 'scripts/immich-export')
-rwxr-xr-xscripts/immich-export4
1 files changed, 3 insertions, 1 deletions
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