From 4831a4374bcf44b3c33744a03729fcfb0ea0d953 Mon Sep 17 00:00:00 2001 From: Christian Bastian <80225746+cdb-boop@users.noreply.github.com> Date: Sun, 8 Sep 2024 04:36:00 -0400 Subject: [PATCH] Added raise error on get web-url when path is empty. --- __init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index b2d125b..a5a2fde 100644 --- a/__init__.py +++ b/__init__.py @@ -1101,12 +1101,12 @@ async def get_model_info(request): async def get_model_web_url(request): model_path = request.query.get("path", None) if model_path is None: - web.json_response({ "url": "" }) + raise ValueError("Missing model path!") model_path = urllib.parse.unquote(model_path) abs_path, model_type = search_path_to_system_path(model_path) if abs_path is None: - web.json_response({ "url": "" }) + raise ValueError("Invalid model path!") sha256_hash = hash_file(abs_path) url = search_web_for_model_url(sha256_hash)