diff options
author | guaneec <guaneec@users.noreply.github.com> | 2022-10-26 06:58:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 06:58:04 +0000 |
commit | 649d79a8ecd20ccf3c375f7116eee4809f844e3c (patch) | |
tree | 0259f0c01540da824c706b7626d5930ebaca9d01 /modules/images.py | |
parent | 877d94f97ca5491d8779440769b191e0dcd32c8e (diff) | |
parent | 757264c453eca533ee1c9ea7e9d9b45a009367d7 (diff) | |
download | stable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.tar.gz stable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.tar.bz2 stable-diffusion-webui-gfx803-649d79a8ecd20ccf3c375f7116eee4809f844e3c.zip |
Merge branch 'master' into hn-activation
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/images.py b/modules/images.py index 286de2ae..bfc2ba06 100644 --- a/modules/images.py +++ b/modules/images.py @@ -277,7 +277,7 @@ invalid_filename_chars = '<>:"/\\|?*\n' invalid_filename_prefix = ' '
invalid_filename_postfix = ' .'
re_nonletters = re.compile(r'[\s' + string.punctuation + ']+')
-re_pattern = re.compile(r"([^\[\]]+|\[([^]]+)]|[\[\]]*)")
+re_pattern = re.compile(r"(.*?)(?:\[([^\[\]]+)\]|$)")
re_pattern_arg = re.compile(r"(.*)<([^>]*)>$")
max_filename_part_length = 128
@@ -343,7 +343,7 @@ class FilenameGenerator: def datetime(self, *args):
time_datetime = datetime.datetime.now()
- time_format = args[0] if len(args) > 0 else self.default_time_format
+ time_format = args[0] if len(args) > 0 and args[0] != "" else self.default_time_format
try:
time_zone = pytz.timezone(args[1]) if len(args) > 1 else None
except pytz.exceptions.UnknownTimeZoneError as _:
@@ -362,9 +362,9 @@ class FilenameGenerator: for m in re_pattern.finditer(x):
text, pattern = m.groups()
+ res += text
if pattern is None:
- res += text
continue
pattern_args = []
@@ -385,12 +385,9 @@ class FilenameGenerator: print(f"Error adding [{pattern}] to filename", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)
- if replacement is None:
- res += f'[{pattern}]'
- else:
+ if replacement is not None:
res += str(replacement)
-
- continue
+ continue
res += f'[{pattern}]'
|