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
try:
check_url = url.replace("/translate", "/languages")
if "/languages" not in check_url:
check_url = url.rstrip("/") + "/../languages"
from urllib.parse import urlparse, urlunparse
parsed = urlparse(url)
# Tomamos solo scheme + netloc y construimos /languages directamente
check_url = urlunparse((parsed.scheme, parsed.netloc, "/languages", "", "", ""))
async with aiohttp.ClientSession() as session:
async with session.get(check_url, timeout=10) as resp:
if resp.status == 200: