Handle save paths across Windows drives

This commit is contained in:
2026-08-05 13:03:16 +00:00
parent 285eb40c92
commit 17f7adba65
2 changed files with 35 additions and 1 deletions
+8 -1
View File
@@ -95,6 +95,13 @@ def _safe_pattern(value):
return value
def _is_within_directory(parent_path, child_path):
try:
return os.path.commonpath([parent_path, child_path]) == parent_path
except ValueError:
return False
def _next_counter(directory, filename_template):
os.makedirs(directory, exist_ok=True)
if "%counter%" not in filename_template:
@@ -356,7 +363,7 @@ class DumasSaveImageNode:
pnginfo = _build_pnginfo(prompt=prompt, extra_pnginfo=extra_pnginfo)
image.save(full_path, "PNG", pnginfo=pnginfo)
if os.path.commonpath([output_dir, full_path]) == output_dir:
if _is_within_directory(output_dir, full_path):
subfolder = os.path.relpath(frame_dir, output_dir)
ui_images.append(
{