mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-09 11:02:12 -03:00
fix(civitai): surface missing-model diagnostics and anchor image-page URL parsing
- Return the ResourceNotFoundError detail from get_civitai_versions and get_model_versions_status instead of a bare "Model not found", and let the download modal display the server-provided message - Anchor extract_civitai_image_id / extractCivitaiImageId to ^/images/<id> so API paths and partial numeric IDs are rejected, same as the model-page parsing fix in #1140
This commit is contained in:
@@ -2881,9 +2881,10 @@ class ModelLibraryHandler:
|
||||
|
||||
try:
|
||||
response = await metadata_provider.get_model_versions(model_id)
|
||||
except ResourceNotFoundError:
|
||||
except ResourceNotFoundError as exc:
|
||||
return web.json_response(
|
||||
{"success": False, "error": "Model not found"}, status=404
|
||||
{"success": False, "error": str(exc) or "Model not found"},
|
||||
status=404,
|
||||
)
|
||||
if not response or not response.get("modelVersions"):
|
||||
return web.json_response(
|
||||
|
||||
@@ -2359,8 +2359,8 @@ class ModelCivitaiHandler:
|
||||
metadata_provider = await self._metadata_provider_factory()
|
||||
try:
|
||||
response = await metadata_provider.get_model_versions(model_id)
|
||||
except ResourceNotFoundError:
|
||||
return web.Response(status=404, text="Model not found")
|
||||
except ResourceNotFoundError as exc:
|
||||
return web.json_response({"error": str(exc)}, status=404)
|
||||
if not response or not response.get("modelVersions"):
|
||||
return web.Response(status=404, text="Model not found")
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ def extract_civitai_image_id(url: str | None) -> str | None:
|
||||
if parsed is None:
|
||||
return None
|
||||
|
||||
path_match = re.search(r"/images/(\d+)", parsed.path)
|
||||
path_match = re.match(r"^/images/(\d+)(?:/|$)", parsed.path)
|
||||
if not path_match:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user