fix(civitai): anchor model-page URL parsing and improve missing-model diagnostics (#1140)

This commit is contained in:
Eric-Yeh
2026-10-09 08:07:00 +08:00
committed by GitHub
parent fad17decdf
commit 01ffda7303
6 changed files with 71 additions and 8 deletions
+9
View File
@@ -1,3 +1,5 @@
import pytest
from py.utils.civitai_utils import (
build_license_flags,
extract_civitai_image_id,
@@ -8,6 +10,13 @@ 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"])
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)
def test_resolve_license_payload_defaults():
payload, flags = resolve_license_info({})