From 2b2257afc934a7139f6bf2fdd4ec6369638db910 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Mon, 28 Apr 2025 14:14:08 +0200 Subject: [PATCH] Fix haddock links when using --haddock When using --haddock, haddocks are served directly under /haddock, so we have to strip the path when generating links. --- src/Action/Server.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Action/Server.hs b/src/Action/Server.hs index 3edac405..635dedda 100644 --- a/src/Action/Server.hs +++ b/src/Action/Server.hs @@ -247,7 +247,7 @@ showFroms local haddock xs = mconcat $ intersperse ", " $ flip map pkgs $ \p -> pkgs = nubOrd $ map targetPackage xs showURL :: Bool -> Maybe FilePath -> URL -> String -showURL _ (Just _) x = "haddock/" ++ dropPrefix "file:///" x +showURL _ (Just haddock) x = "haddock/" ++ dropPrefix ("file://" ++ haddock) x showURL True _ (stripPrefix "file:///" -> Just x) = "file/" ++ x showURL _ _ x = x