mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-09 02:52: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:
@@ -10,14 +10,27 @@ from py.utils.civitai_utils import (
|
||||
resolve_license_payload,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("host", ["civitai.com", "civitai.red"])
|
||||
@pytest.mark.parametrize("path", ["/api/download/models/3390681", "/api/v1/models/3390681", "/models/3390681invalid"])
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
["/api/download/models/3390681", "/api/v1/models/3390681", "/models/3390681invalid"],
|
||||
)
|
||||
def test_extract_civitai_model_url_parts_rejects_non_model_pages(host, path):
|
||||
assert extract_civitai_model_url_parts(
|
||||
f"https://{host}{path}?modelVersionId=3390681"
|
||||
) == (None, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("host", ["civitai.com", "civitai.red"])
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
["/api/v1/images/126920345", "/images/126920345invalid"],
|
||||
)
|
||||
def test_extract_civitai_image_id_rejects_non_image_pages(host, path):
|
||||
assert extract_civitai_image_id(f"https://{host}{path}") is None
|
||||
|
||||
|
||||
def test_resolve_license_payload_defaults():
|
||||
payload, flags = resolve_license_info({})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user