From b248fcf346ff4024f2aaa737a6a3a882a1d93187 Mon Sep 17 00:00:00 2001 From: Rhys Yang Date: Fri, 28 Jun 2024 15:20:16 +0800 Subject: [PATCH] Fix the `Prompt Saver` unable to correctly handle filenames containing `.` #80 --- nodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index 5c96647..b233525 100644 --- a/nodes.py +++ b/nodes.py @@ -669,13 +669,13 @@ class SDPromptSaver: @staticmethod def get_unique_filename(stem: Path, extension: str, output_folder: Path): - file = stem.with_suffix(f".{extension}") + file = stem.with_suffix(f"{stem.suffix}.{extension}") index = 0 while (output_folder / file).exists(): index += 1 - new_stem = f"{stem}_{index}" - file = Path(new_stem).with_suffix(f".{extension}") + new_stem = Path(f"{stem}_{index}") + file = new_stem.with_suffix(f"{new_stem.suffix}.{extension}") return file