fix(image_node): prevent redundant CDN URL sends on 204 responses

The refactored code checked only `if save_cdn_urls:` instead of the
original `if save_cdn_urls and response.status_code == 200:`. While
extract_cdn_urls_from_response correctly returns empty for 204 responses,
accumulated URLs from prior iterations could still trigger the
`if batch_cdn_urls:` condition, causing duplicate sends.

Fixed in both individual image send and batch send sections.

Fixes issue identified in PR #35 review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
AEmotionStudio
2026-01-20 02:54:58 -08:00
co-authored by Claude Opus 4.5
parent 36c5d06cf8
commit cc07d20f86
+4 -2
View File
@@ -672,7 +672,8 @@ class DiscordSendSaveImage:
print(f"Successfully sent workflow JSON for image {batch_number+1}")
# Extract CDN URLs and send file using shared utility
if save_cdn_urls:
# Only extract when status is 200 (has content), not 204 (no content)
if save_cdn_urls and response.status_code == 200:
new_urls = extract_cdn_urls_from_response(response)
batch_cdn_urls.extend(new_urls)
if batch_cdn_urls:
@@ -761,7 +762,8 @@ class DiscordSendSaveImage:
discord_sent_files = ["batch_gallery"] # Mark as successfully sent
# Extract CDN URLs and send file using shared utility
if save_cdn_urls:
# Only extract when status is 200 (has content), not 204 (no content)
if save_cdn_urls and response.status_code == 200:
new_urls = extract_cdn_urls_from_response(response)
batch_cdn_urls.extend(new_urls)
if batch_cdn_urls: