diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-09 09:33:37 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-09 09:33:37 +0000 |
commit | 6f6798ddabe10d320fe8ea05edf0fdcef0c51a8e (patch) | |
tree | 484ea2e57c9581db1d0e96b6888cdf31eebcbb40 | |
parent | 0241d811d23427b99f6b1eda1540bdf8d87963d5 (diff) | |
download | stable-diffusion-webui-gfx803-6f6798ddabe10d320fe8ea05edf0fdcef0c51a8e.tar.gz stable-diffusion-webui-gfx803-6f6798ddabe10d320fe8ea05edf0fdcef0c51a8e.tar.bz2 stable-diffusion-webui-gfx803-6f6798ddabe10d320fe8ea05edf0fdcef0c51a8e.zip |
prevent a possible code execution error (thanks, RyotaK)
-rw-r--r-- | modules/ui.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/ui.py b/modules/ui.py index e1ab2665..dad509f3 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1153,6 +1153,15 @@ def create_ui(wrap_gradio_gpu_call): component_dict = {}
def open_folder(f):
+ if not os.path.isdir(f):
+ print(f"""
+WARNING
+An open_folder request was made with an argument that is not a folder.
+This could be an error or a malicious attempt to run code on your computer.
+Requested path was: {f}
+""", file=sys.stderr)
+ return
+
if not shared.cmd_opts.hide_ui_dir_config:
path = os.path.normpath(f)
if platform.system() == "Windows":
|