Validate civitai URL input before parsing
Add an early guard in core/sources/civitai.py to return None for non-string or empty URL inputs before calling urlparse. This prevents exceptions and unexpected behavior when callers pass None or empty values, making the parser more robust.
This commit is contained in:
@@ -640,6 +640,8 @@ def parse_civitai_url(url: str) -> Optional[Dict[str, Any]]:
|
||||
"""
|
||||
Parse a CivitAI URL to extract model/version info.
|
||||
"""
|
||||
if not isinstance(url, str) or not url.strip():
|
||||
return None
|
||||
parsed = urlparse(url)
|
||||
if "civitai.com" not in parsed.netloc:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user