Commit e85fcb82 authored by comfyanonymous's avatar comfyanonymous
Browse files

Small fix.

parent 0abe001e
...@@ -744,16 +744,16 @@ class SaveImage: ...@@ -744,16 +744,16 @@ class SaveImage:
except: except:
digits = 0 digits = 0
return (digits, prefix) return (digits, prefix)
subfolder = os.path.dirname(os.path.normpath(filename_prefix)) subfolder = os.path.dirname(os.path.normpath(filename_prefix))
filename = os.path.basename(os.path.normpath(filename_prefix)) filename = os.path.basename(os.path.normpath(filename_prefix))
full_output_folder = os.path.join(self.output_dir, subfolder) full_output_folder = os.path.join(self.output_dir, subfolder)
if os.path.commonpath((self.output_dir, os.path.realpath(full_output_folder))) != self.output_dir: if os.path.commonpath((self.output_dir, os.path.realpath(full_output_folder))) != self.output_dir:
print("Saving image outside the output folder is not allowed.") print("Saving image outside the output folder is not allowed.")
return return {}
try: try:
counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1 counter = max(filter(lambda a: a[1][:-1] == filename and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
except ValueError: except ValueError:
...@@ -784,7 +784,7 @@ class SaveImage: ...@@ -784,7 +784,7 @@ class SaveImage:
"type": self.type "type": self.type
}); });
counter += 1 counter += 1
return { "ui": { "images": results } } return { "ui": { "images": results } }
class PreviewImage(SaveImage): class PreviewImage(SaveImage):
......
...@@ -109,7 +109,7 @@ class ComfyApp { ...@@ -109,7 +109,7 @@ class ComfyApp {
return new Promise((r) => { return new Promise((r) => {
const img = new Image(); const img = new Image();
img.onload = () => r(img); img.onload = () => r(img);
img.onerror = () => r(null); img.onerror = () => r(null);
img.src = "/view?" + new URLSearchParams(src).toString(); img.src = "/view?" + new URLSearchParams(src).toString();
}); });
}) })
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment