aboutsummaryrefslogtreecommitdiffstats
path: root/modules/images.py
diff options
context:
space:
mode:
authorAlex "mcmonkey" Goodwin <git_commits@alexgoodwin.dev>2023-03-12 19:30:31 +0000
committerAlex "mcmonkey" Goodwin <git_commits@alexgoodwin.dev>2023-03-12 19:30:31 +0000
commita71b7b5ec09a24e8a9bb3385e32862da905af6f1 (patch)
tree861d5f9d5fe94d85fe5a4f3948e246bd56d95ca7 /modules/images.py
parent7fd19fa4e7039746dc98990883acfa500b90b6c7 (diff)
downloadstable-diffusion-webui-gfx803-a71b7b5ec09a24e8a9bb3385e32862da905af6f1.tar.gz
stable-diffusion-webui-gfx803-a71b7b5ec09a24e8a9bb3385e32862da905af6f1.tar.bz2
stable-diffusion-webui-gfx803-a71b7b5ec09a24e8a9bb3385e32862da905af6f1.zip
relocate filename length limit to better spot
Diffstat (limited to 'modules/images.py')
-rw-r--r--modules/images.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/images.py b/modules/images.py
index 4c204fca..2ce5c67c 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -512,9 +512,6 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
file_decoration = "-" + file_decoration
file_decoration = namegen.apply(file_decoration) + suffix
- if hasattr(os, 'statvfs'):
- max_name_len = os.statvfs(path).f_namemax
- file_decoration = file_decoration[:max_name_len - 5]
if add_number:
basecount = get_next_sequence_number(path, basename)
@@ -576,6 +573,10 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
os.replace(temp_file_path, filename_without_extension + extension)
fullfn_without_extension, extension = os.path.splitext(params.filename)
+ if hasattr(os, 'statvfs'):
+ max_name_len = os.statvfs(path).f_namemax
+ fullfn_without_extension = fullfn_without_extension[:max_name_len - len(extension)]
+ params.filename = fullfn_without_extension + extension
_atomically_save_image(image, fullfn_without_extension, extension)
image.already_saved_as = fullfn