From 724579a607dc49ca432687580cbb961cbbec73ef Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Sat, 4 Jul 2026 18:05:30 +0200 Subject: [PATCH] fix(civitai): recognize civitai.red URLs in parse_civitai_url The URL parser previously required the hostname to contain "civitai.com", so CivitAI download links using the "civitai.red" domain were treated as non-CivitAI URLs and rejected. This extracts the host check into _is_civitai_host() and accepts both "civitai.com" and "civitai.red" base domains, so resolve/parse flows handle all CivitAI download links correctly. --- core/sources/civitai.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/sources/civitai.py b/core/sources/civitai.py index d4ef32f..a32036a 100644 --- a/core/sources/civitai.py +++ b/core/sources/civitai.py @@ -51,6 +51,16 @@ MAX_CIVITAI_CANDIDATE_LIMIT = 20 MODEL_TITLE_MATCH_THRESHOLD = 82.0 +def _is_civitai_host(host: Optional[str]) -> bool: + host = str(host or "").lower().strip(".") + return ( + host == "civitai.com" + or host.endswith(".civitai.com") + or host == "civitai.red" + or host.endswith(".civitai.red") + ) + + @@ -782,7 +792,7 @@ def parse_civitai_url(url: str) -> Optional[Dict[str, Any]]: if not isinstance(url, str) or not url.strip(): return None parsed = urlparse(url) - if "civitai.com" not in parsed.netloc: + if not _is_civitai_host(parsed.hostname): return None if "/api/download/models/" in parsed.path: