Handle save paths across Windows drives
This commit is contained in:
@@ -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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user