diff options
author | unknown <mcgpapu@gmail.com> | 2023-02-05 13:24:57 +0000 |
---|---|---|
committer | unknown <mcgpapu@gmail.com> | 2023-02-05 13:24:57 +0000 |
commit | 501d4e9cf111c2b94805181e3ab2e1b8b5d81f31 (patch) | |
tree | 712d6e405c406e573e8f2b7f44b9e4462432ff61 /modules/ui_extra_networks.py | |
parent | 5e1f4f7464e560a2468812fc9d5cb38659cff86c (diff) | |
parent | ea9bd9fc7409109adcd61b897abc2c8881161256 (diff) | |
download | stable-diffusion-webui-gfx803-501d4e9cf111c2b94805181e3ab2e1b8b5d81f31.tar.gz stable-diffusion-webui-gfx803-501d4e9cf111c2b94805181e3ab2e1b8b5d81f31.tar.bz2 stable-diffusion-webui-gfx803-501d4e9cf111c2b94805181e3ab2e1b8b5d81f31.zip |
Merge branch 'master' of github.com:AUTOMATIC1111/stable-diffusion-webui into gamepad
Diffstat (limited to 'modules/ui_extra_networks.py')
-rw-r--r-- | modules/ui_extra_networks.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 83367968..90abec0a 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -26,11 +26,12 @@ def add_pages_to_demo(app): def fetch_file(filename: str = ""):
from starlette.responses import FileResponse
- if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):
+ if not any([Path(x).absolute() in Path(filename).absolute().parents for x in allowed_dirs]):
raise ValueError(f"File cannot be fetched: {filename}. Must be in one of directories registered by extra pages.")
- if os.path.splitext(filename)[1].lower() != ".png":
- raise ValueError(f"File cannot be fetched: {filename}. Only png.")
+ ext = os.path.splitext(filename)[1].lower()
+ if ext not in (".png", ".jpg"):
+ raise ValueError(f"File cannot be fetched: {filename}. Only png and jpg.")
# would profit from returning 304
return FileResponse(filename, headers={"Accept-Ranges": "bytes"})
|