Fix: Health Check usa urllib.parse para no corromper el hostname del dominio (#10)

This commit is contained in:
2026-03-20 18:28:21 -06:00
parent 7d4fc17567
commit 95904b41a3

View File

@@ -81,9 +81,10 @@ async def check_libretranslate_health(url: str) -> bool:
_last_health_check = now _last_health_check = now
try: try:
check_url = url.replace("/translate", "/languages") from urllib.parse import urlparse, urlunparse
if "/languages" not in check_url: parsed = urlparse(url)
check_url = url.rstrip("/") + "/../languages" # Tomamos solo scheme + netloc y construimos /languages directamente
check_url = urlunparse((parsed.scheme, parsed.netloc, "/languages", "", "", ""))
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get(check_url, timeout=10) as resp: async with session.get(check_url, timeout=10) as resp:
if resp.status == 200: if resp.status == 200: