diff --git a/nodes.py b/nodes.py index 7b27ef54..b4901a85 100644 --- a/nodes.py +++ b/nodes.py @@ -802,8 +802,9 @@ class SaveImage: digits = 0 return (digits, prefix) - subfolder = os.path.dirname(filename_prefix) - filename = os.path.basename(filename_prefix) + subfolder = os.path.dirname(os.path.normpath(filename_prefix)) + filename = os.path.basename(os.path.normpath(filename_prefix)) + 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: diff --git a/web/scripts/app.js b/web/scripts/app.js index 31c575d7..1d777130 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -110,9 +110,11 @@ class ComfyApp { const img = new Image(); img.onload = () => r(img); img.onerror = () => r(null); + var filename = src.replace(/^.*[\\\/]/, ''); var subfolder = src.replace(filename, ''); - img.src = "/view?file=" + filename + "&subfolder=" + subfolder; + var params = new URLSearchParams({file: filename, subfolder}); + img.src = "/view?" + params.toString(); }); }) ).then((imgs) => {