From a676cf658b968794a906ac1d5d61268eb69677e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Wed, 14 Dec 2022 15:48:19 +0100 Subject: [PATCH] Utilities: Resolve manpage paths more robustly in markdown-check The path is now relative to the Serenity source directory, and later parts of the URL path are not simply discarded. This allows links into subsection man pages to be checked correctly. --- Userland/Utilities/markdown-check.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index e8eba49863..fe93b0e865 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -196,7 +196,9 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no m_has_invalid_link = true; return RecursionDecision::Recurse; } - auto file = DeprecatedString::formatted("../man{}/{}.md", url.paths()[0], url.paths()[1]); + + // Remove leading '/' from the path. + auto file = DeprecatedString::formatted("{}/Base/usr/share/man/man{}.md", m_serenity_source_directory, url.path().substring(1)); m_file_links.append({ file, DeprecatedString(), StringCollector::from(*link_node.text) }); return RecursionDecision::Recurse;