From 9261587d8975bb0c3f929433345e9918bf659460 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 7 Sep 2023 18:14:30 -0400 Subject: [PATCH] Small refactor. --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index e58a11d8..be33f410 100644 --- a/server.py +++ b/server.py @@ -170,9 +170,9 @@ class PromptServer(): subfolder = post.get("subfolder", "") full_output_folder = os.path.join(upload_dir, os.path.normpath(subfolder)) - filepath = os.path.join(full_output_folder, filename) + filepath = os.path.abspath(os.path.join(full_output_folder, filename)) - if os.path.commonpath((upload_dir, os.path.abspath(filepath))) != upload_dir: + if os.path.commonpath((upload_dir, filepath)) != upload_dir: return web.Response(status=400) if not os.path.exists(full_output_folder):