feat: Enhance URL handling in CalibreOPDSClient to preserve catalog prefix for relative paths

This commit is contained in:
JB
2025-11-11 06:57:27 -08:00
parent 387d324ea0
commit 4491674fac
2 changed files with 15 additions and 1 deletions
+6 -1
View File
@@ -166,7 +166,12 @@ class CalibreOPDSClient:
href = href.strip()
if href.startswith("http://") or href.startswith("https://"):
return href
return urljoin(self._base_url, href)
if href.startswith("/") or href.startswith("?") or href.startswith("#"):
return urljoin(self._base_url, href)
if href.startswith("./") or href.startswith("../"):
return urljoin(self._base_url, href)
# Ensure relative paths like "search" keep the catalog prefix
return urljoin(self._base_url, f"./{href}")
def _open_client(self) -> httpx.Client:
return httpx.Client(