From 9d30eb4b34ddbd17d666a9ac50e654e484125970 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Sat, 8 Apr 2023 22:51:59 +0100 Subject: LibManual: Allow paths that include subsections when creating PageNodes Previously, attempting to open a man file within a subsection would fail. --- Userland/Libraries/LibManual/Node.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibManual/Node.cpp b/Userland/Libraries/LibManual/Node.cpp index 4c89ff8a7a..e54fcc8595 100644 --- a/Userland/Libraries/LibManual/Node.cpp +++ b/Userland/Libraries/LibManual/Node.cpp @@ -32,16 +32,23 @@ ErrorOr> Node::try_create_from_query(Vector(section, TRY(String::from_utf8(path_from_query.title()))); + auto page_name_end_index = section_directory.length() - section_name_end_index.value() - MARKDOWN_FILE_EXTENSION.length() - 1; + auto page_name = section_directory.substring_view(section_name_end_index.value(), page_name_end_index); + return try_make_ref_counted(section, TRY(String::from_utf8(page_name))); } // [page] (in any section) -- cgit v1.2.3