Fix FolderServeNode.

This commit is contained in:
Relintai 2022-07-02 19:58:43 +02:00
parent 8840439f7a
commit 6f10e05c32
3 changed files with 6 additions and 10 deletions

View File

@ -17,7 +17,7 @@ void BrowsableFolderServeNode::set_should_render_menu(const bool &val) {
_should_render_menu = val;
}
void BrowsableFolderServeNode::_handle_request_main(Ref<WebServerRequest> request) {
void BrowsableFolderServeNode::_handle_request(Ref<WebServerRequest> request) {
String file_name = request->get_path(true, false);
String *s = _folder_indexes[file_name];
@ -28,7 +28,7 @@ void BrowsableFolderServeNode::_handle_request_main(Ref<WebServerRequest> reques
}
if (_should_render_menu) {
render_menu(request);
render_main_menu(request);
}
request->body += (*s);

View File

@ -27,7 +27,7 @@ public:
bool get_should_render_menu();
void set_should_render_menu(const bool &val);
void _handle_request_main(Ref<WebServerRequest> request);
void _handle_request(Ref<WebServerRequest> request);
void render_index(Ref<WebServerRequest> request);
void render_preview(Ref<WebServerRequest> request);

View File

@ -22,7 +22,7 @@ void FolderServeNode::_handle_request_main(Ref<WebServerRequest> request) {
if (rp == "") {
if (!try_route_request_to_children(request)) {
_handle_request_main(request);
handle_request(request);
}
return;
}
@ -33,16 +33,12 @@ void FolderServeNode::_handle_request_main(Ref<WebServerRequest> request) {
int file_indx = _file_cache->wwwroot_get_file_index(file_name);
if (file_indx != -1) {
String fp = _file_cache->get_wwwroot_abs();
fp = fp.append_path(file_name);
request->send_file(_file_cache->wwwroot_get_file_orig_path(file_indx));
request->send_file(_file_cache->wwwroot_get_file_orig_path_abs(file_indx));
return;
}
if (!try_route_request_to_children(request)) {
_handle_request_main(request);
handle_request(request);
}
}