From ebe276ee44c5bf92a27cf320cac75012035d0d96 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Mon, 7 Aug 2023 19:22:50 +0200 Subject: [PATCH] Fix for lora filenames containing dots Since file extensions are already cut off before the client-side request, it's not needed here anymore --- scripts/tag_autocomplete_helper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index ba6982e..3928bdd 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -453,8 +453,7 @@ def api_tac(_: gr.Blocks, app: FastAPI): return json.dumps({}) try: - name = Path(filename).stem - json_candidates = glob.glob(base_path.as_posix() + f"/**/{name}.json", recursive=True) + json_candidates = glob.glob(base_path.as_posix() + f"/**/{filename}.json", recursive=True) if json_candidates is not None and len(json_candidates) > 0: return FileResponse(json_candidates[0]) except Exception as e: @@ -465,8 +464,7 @@ def api_tac(_: gr.Blocks, app: FastAPI): return json.dumps({}) try: - name = Path(filename).stem - img_glob = glob.glob(base_path.as_posix() + f"/**/{name}.*", recursive=True) + img_glob = glob.glob(base_path.as_posix() + f"/**/{filename}.*", recursive=True) img_candidates = [img for img in img_glob if Path(img).suffix in [".png", ".jpg", ".jpeg", ".webp"]] if img_candidates is not None and len(img_candidates) > 0: return JSONResponse({"url": urllib.parse.quote(img_candidates[0])})