Naming convention fixes

This commit is contained in:
Sirshendu Ganguly
2026-02-02 14:20:21 -05:00
parent 81f37cb846
commit 6005111622
2 changed files with 8 additions and 11 deletions
+3 -4
View File
@@ -37,10 +37,9 @@ class RunwareSave3D:
CATEGORY = "Runware"
DESCRIPTION = "Save 3D model files (GLB/PLY) from Runware 3D Inference to the output folder."
def save_3d(self, **kwargs):
def save_3d(self, filenamePrefix="ComfyUI", **kwargs):
"""Save 3D file from URL"""
file_url = kwargs.get("3dObject", "")
filename_prefix = kwargs.get("filenamePrefix", "ComfyUI")
if not file_url or not file_url.strip():
raise Exception("No 3D URL provided. Please connect the '3dObject' output from Runware 3D Inference node.")
@@ -59,9 +58,9 @@ class RunwareSave3D:
if extension not in ["glb", "ply"]:
raise Exception(f"Unsupported 3D file extension '{extension}' from URL. Expected .glb or .ply.")
# Sanitize filename_prefix to prevent path traversal or arbitrary subdir creation
# Sanitize filenamePrefix to prevent path traversal or arbitrary subdir creation
prefix_basename = os.path.basename(
filename_prefix.replace(os.sep, "_").replace(os.altsep or os.sep, "_")
filenamePrefix.replace(os.sep, "_").replace(os.altsep or os.sep, "_")
)
safe_prefix = re.sub(r"[^\w\-]", "", prefix_basename) or "ComfyUI"
+5 -7
View File
@@ -32,10 +32,8 @@ class RunwareSaveImage:
OUTPUT_NODE = True
CATEGORY = "Runware"
def save_images(self, Images, **kwargs):
def save_images(self, Images, filenamePrefix="ComfyUI", saveImage=True):
"""Save images using URL directly"""
filename_prefix = kwargs.get("filenamePrefix", "ComfyUI")
save_image = kwargs.get("saveImage", True)
# Split URLs if comma-separated (for batch processing)
image_urls = [url.strip() for url in Images.split(",") if url.strip()]
@@ -44,7 +42,7 @@ class RunwareSaveImage:
raise Exception("No image added provided. Please connect the 'Image' from Runware Image Inference node.")
# Use output dir when saving, temp dir for preview only (purged on restart)
if save_image:
if saveImage:
output_dir = folder_paths.get_output_directory()
os.makedirs(output_dir, exist_ok=True)
file_type = "output"
@@ -64,14 +62,14 @@ class RunwareSaveImage:
extension = "." + url_without_params.split('.')[-1]
if len(image_urls) > 1:
filename = f"{filename_prefix}_{timestamp}_{i+1:03}.{extension.lstrip('.')}"
filename = f"{filenamePrefix}_{timestamp}_{i+1:03}.{extension.lstrip('.')}"
else:
filename = f"{filename_prefix}_{timestamp}.{extension.lstrip('.')}"
filename = f"{filenamePrefix}_{timestamp}.{extension.lstrip('.')}"
filepath = os.path.join(output_dir, filename)
with open(filepath, 'wb') as f:
f.write(img_data)
print(f"[Runware] {'Saved' if save_image else 'Preview'}: {filepath}")
print(f"[Runware] {'Saved' if saveImage else 'Preview'}: {filepath}")
saved_files.append({
"filename": filename,