From cc07d20f86aa449a9155b3141c145a974eec2428 Mon Sep 17 00:00:00 2001 From: AEmotionStudio <163354043+AEmotionStudio@users.noreply.github.com> Date: Tue, 20 Jan 2026 02:54:58 -0800 Subject: [PATCH] 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 --- nodes/image_node.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodes/image_node.py b/nodes/image_node.py index 9298cf6..01580bb 100644 --- a/nodes/image_node.py +++ b/nodes/image_node.py @@ -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: