From 88a46e8427fbaa73eb37c9eaabbb62b8647a5f32 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Sat, 4 Feb 2023 09:10:00 -0800 Subject: [PATCH] fix symlinks in extra networks ui 'absolute' and 'resolve' are equivalent, but 'resolve' resolves symlinks (which is an obscure specialty behavior usually not wanted) whereas 'absolute' treats symlinks as folders (which is the expected behavior). This commit allows you to symlink folders within your models/embeddings/etc. dirs and have preview images load as expected without issue. --- modules/ui_extra_networks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 95b30f4a..90abec0a 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -26,7 +26,7 @@ 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.") ext = os.path.splitext(filename)[1].lower()