From decd7def28f6296143f579ed9e4d444e3ac5826c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 01:26:03 +0000 Subject: [PATCH] Fix broken boolean inputs in discord_image_node The `overwrite_last`, `add_dimensions`, and `resize_to_power_of_2` inputs were checking for string equality `== "enable"`, but the inputs are defined as `BOOLEAN` in `INPUT_TYPES`, which pass Python boolean values (`True`/`False`). This commit fixes the conditional logic to check for truthiness, restoring the functionality of these UI controls. This is a UX improvement as it fixes broken UI controls. --- discord_image_node.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discord_image_node.py b/discord_image_node.py index ef88fee..3c477c7 100644 --- a/discord_image_node.py +++ b/discord_image_node.py @@ -295,7 +295,7 @@ class DiscordSendSaveImage: filename_prefix, dest_folder, images[0].shape[1], images[0].shape[0]) # For overwrite functionality, we'll just always use the same counter instead of bypassing validation - if overwrite_last == "enable": + if overwrite_last: counter = 1 # Always use the same counter value for overwriting else: # When not overwriting, we need to find the highest existing counter and start from there @@ -327,7 +327,7 @@ class DiscordSendSaveImage: print(f"Error determining next file counter: {e}") # Default to ComfyUI's counter if we can't determine the next one - print(f"Using counter: {counter} for {'overwriting' if overwrite_last == 'enable' else 'new files'}") + print(f"Using counter: {counter} for {'overwriting' if overwrite_last else 'new files'}") print(f"Output prefix: {filename_prefix}") # Map resize method strings to PIL resize methods @@ -443,7 +443,7 @@ class DiscordSendSaveImage: orig_width, orig_height = img.size # Resize to power of 2 if enabled - if resize_to_power_of_2 == "enable": + if resize_to_power_of_2: # Calculate nearest power of 2 dimensions new_width = 2 ** int(np.log2(orig_width) + 0.5) # Round to nearest power of 2 new_height = 2 ** int(np.log2(orig_height) + 0.5) # Round to nearest power of 2 @@ -471,7 +471,7 @@ class DiscordSendSaveImage: # Add dimensions to filename if enabled dimensions_suffix = "" - if add_dimensions == "enable": + if add_dimensions: dimensions_suffix = f"_{width}x{height}" filename_prefix += dimensions_suffix @@ -524,7 +524,7 @@ class DiscordSendSaveImage: filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) # Add dimensions tag before the counter if enabled - if add_dimensions == "enable" and dimensions_suffix not in filename_with_batch_num: + if add_dimensions and dimensions_suffix not in filename_with_batch_num: # Insert dimensions before counter base_name = os.path.splitext(filename_with_batch_num)[0] filename_with_batch_num = f"{base_name}{dimensions_suffix}" @@ -790,7 +790,7 @@ class DiscordSendSaveImage: discord_send_success = False # Increment counter if not overwriting - if overwrite_last != "enable": + if not overwrite_last: counter += 1 except Exception as e: print(f"Error saving image: {e}")