mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
Merge pull request #8503 from mcmonkey4eva/filename-length-limit-fix
Add correction file filename length limits on *nix systems
This commit is contained in:
commit
a9fed7c364
@ -573,6 +573,11 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
|
|||||||
os.replace(temp_file_path, filename_without_extension + extension)
|
os.replace(temp_file_path, filename_without_extension + extension)
|
||||||
|
|
||||||
fullfn_without_extension, extension = os.path.splitext(params.filename)
|
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 - max(4, len(extension))]
|
||||||
|
params.filename = fullfn_without_extension + extension
|
||||||
|
fullfn = params.filename
|
||||||
_atomically_save_image(image, fullfn_without_extension, extension)
|
_atomically_save_image(image, fullfn_without_extension, extension)
|
||||||
|
|
||||||
image.already_saved_as = fullfn
|
image.already_saved_as = fullfn
|
||||||
|
Loading…
Reference in New Issue
Block a user