From 1a0cb5c7290ef014f1747cdb2b501ccab5bf1506 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Thu, 25 Jul 2024 10:40:28 +0100 Subject: [PATCH] Don't try to fix relative links if they already start with "http" Fixes #648 --- ford/output.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ford/output.py b/ford/output.py index 3f097a43..13c0ba21 100644 --- a/ford/output.py +++ b/ford/output.py @@ -89,7 +89,12 @@ def relative_url(entity: Union[FortranBase, str], page_url: pathlib.Path) -> str link_str = str(entity) link = BeautifulSoup(link_str, features="html.parser").a if link is not None: - link_path = str(pathlib.Path(str(link["href"])).resolve()) + link_href = str(link["href"]) + if link_href.startswith("http"): + # This is (almost certainly) an external link, so better + # be correct already + return entity + link_path = str(pathlib.Path(link_href).resolve()) else: link_path = link_str