Tweak WebNode::get_full_uri() to give back the output what you'd normally assume when the uri segment is "/" under a WebRoot.

This commit is contained in:
Relintai 2024-05-04 15:57:06 +02:00
parent 956bc0e9a0
commit 225bfef3e6
2 changed files with 9 additions and 4 deletions

View File

@ -58,6 +58,15 @@ void WebNode::set_uri_segment(const String &val) {
} }
String WebNode::get_full_uri(const bool slash_at_the_end) { String WebNode::get_full_uri(const bool slash_at_the_end) {
// Special case for WebRoots for ease of use
if (_uri_segment == "/") {
if (slash_at_the_end) {
return _uri_segment;
} else {
return String();
}
}
if (slash_at_the_end) { if (slash_at_the_end) {
return get_full_uri_parent(true) + _uri_segment + "/"; return get_full_uri_parent(true) + _uri_segment + "/";
} else { } else {

View File

@ -140,10 +140,6 @@ void BrowsableFolderServeWebPage::render_dir_page(const String &dir_uri, const V
String uri = get_full_uri(false); String uri = get_full_uri(false);
if (uri == "/") {
uri = "";
}
b.div("file_list"); b.div("file_list");
{ {
if (!top_level) { if (!top_level) {