mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibManual: Trim page name correctly when full path is provided
We would previously add an extra "/" at the beginning, since the section name end points exactly at the found "/".
This commit is contained in:
parent
dfd0942e41
commit
b1eacf8801
1 changed files with 2 additions and 1 deletions
|
@ -53,7 +53,8 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
|
|||
auto section_name = section_directory.substring_view(section_name_start_index, section_name_end_index.value() - section_name_start_index);
|
||||
auto section = TRY(SectionNode::try_create_from_number(section_name));
|
||||
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);
|
||||
// +1 to trim the leading '/' from the start.
|
||||
auto page_name = section_directory.substring_view(section_name_end_index.value() + 1, page_name_end_index - 1);
|
||||
return try_make_ref_counted<PageNode>(section, TRY(String::from_utf8(page_name)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue