Allow output folder to be a symbolic link

This commit is contained in:
Jairo Correa 2023-03-23 21:25:21 -03:00
parent dd095efc2c
commit 4f24e6a13b
2 changed files with 2 additions and 2 deletions

View File

@ -752,7 +752,7 @@ class SaveImage:
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.abspath(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 {}

View File

@ -125,7 +125,7 @@ class PromptServer():
output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), type) output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), type)
if "subfolder" in request.rel_url.query: if "subfolder" in request.rel_url.query:
full_output_dir = os.path.join(output_dir, request.rel_url.query["subfolder"]) full_output_dir = os.path.join(output_dir, request.rel_url.query["subfolder"])
if os.path.commonpath((os.path.realpath(full_output_dir), output_dir)) != output_dir: if os.path.commonpath((os.path.abspath(full_output_dir), output_dir)) != output_dir:
return web.Response(status=403) return web.Response(status=403)
output_dir = full_output_dir output_dir = full_output_dir