if image on disk was deleted between being generated and request being completed, do use temporary dir to store it for the browser

This commit is contained in:
AUTOMATIC 2022-11-27 23:14:13 +03:00
parent aa12dfada0
commit bb11bee22a
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ Savedfile = namedtuple("Savedfile", ["name"])
def save_pil_to_file(pil_image, dir=None):
already_saved_as = getattr(pil_image, 'already_saved_as', None)
if already_saved_as:
if already_saved_as and os.path.isfile(already_saved_as):
shared.demo.temp_dirs = shared.demo.temp_dirs | {os.path.abspath(os.path.dirname(already_saved_as))}
file_obj = Savedfile(already_saved_as)
return file_obj