Don't echo full URLs and raw exception text from probe failures.

This commit is contained in:
Talmaj Marinc 2026-06-30 17:08:09 +02:00
parent e0b07014c0
commit 7dba134cda

View File

@ -12,6 +12,7 @@ from __future__ import annotations
import logging import logging
from dataclasses import dataclass from dataclasses import dataclass
from typing import Optional from typing import Optional
from urllib.parse import urlparse
import aiohttp import aiohttp
@ -86,5 +87,6 @@ async def probe(url: str, *, credential_id: Optional[str] = None) -> ProbeResult
last_modified=headers.get("Last-Modified"), last_modified=headers.get("Last-Modified"),
) )
except Exception as e: # network / SSRF / timeout except Exception as e: # network / SSRF / timeout
logging.debug("[model_downloader] probe failed for %s: %s", url, e) host = urlparse(url).netloc or "<unknown>"
return ProbeResult(ok=False, status=0, error=f"{type(e).__name__}: {e}") logging.debug("[model_downloader] probe failed for %s: %s", host, type(e).__name__)
return ProbeResult(ok=False, status=0, error="probe failed: network error")