diff --git a/html/management.html b/html/management.html
index 8f50b12..ceda7c7 100644
--- a/html/management.html
+++ b/html/management.html
@@ -593,8 +593,6 @@
}
- Sleep(1000);
-
}
}, false);
@@ -620,23 +618,10 @@
function handleDeleteData(nodeId) {
var ref = $('#explorerTree').jstree(true);
var node = ref.get_node(nodeId);
- var children = $("#explorerTree").jstree("get_children_dom",nodeId);
- console.log(children.length);
- if(node.data.directory) {
- if(children.length > 0) {
- for(var i=0;i setTimeout(resolve, milliseconds));
- }
+
function fileNameSort( a, b ) {
if ( a.dir && !b.dir ) {
return -1
diff --git a/src/HTMLmanagement.h b/src/HTMLmanagement.h
index 3126620..ee7f2c8 100644
--- a/src/HTMLmanagement.h
+++ b/src/HTMLmanagement.h
@@ -592,8 +592,6 @@ static const char management_HTML[] PROGMEM = "\
if (percentComplete === 100) {\
\
}\
-\
- Sleep(1000);\
\
}\
}, false);\
@@ -620,23 +618,10 @@ static const char management_HTML[] PROGMEM = "\
function handleDeleteData(nodeId) {\
var ref = $('#explorerTree').jstree(true);\
var node = ref.get_node(nodeId);\
- var children = $(\"#explorerTree\").jstree(\"get_children_dom\",nodeId);\
- console.log(children.length);\
- if(node.data.directory) {\
- if(children.length > 0) {\
- for(var i=0;i setTimeout(resolve, milliseconds));\
- }\
+\
function fileNameSort( a, b ) {\
if ( a.dir && !b.dir ) {\
return -1\
diff --git a/src/main.cpp b/src/main.cpp
index 55db775..fdc9c77 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3904,7 +3904,7 @@ void explorerHandleFileStorageTask(void *parameter) {
// Sends a list of the content of a directory as JSON file
// requires a GET parameter path for the directory
void explorerHandleListRequest(AsyncWebServerRequest *request) {
- DynamicJsonDocument jsonBuffer(8192);
+ DynamicJsonDocument jsonBuffer(16384);
//StaticJsonDocument<4096> jsonBuffer;
String serializedJsonString;
AsyncWebParameter *param;
@@ -3951,11 +3951,30 @@ void explorerHandleListRequest(AsyncWebServerRequest *request) {
request->send(200, "application/json; charset=iso-8859-1", serializedJsonString);
}
+bool explorerDeleteDirectory(File dir) {
+
+ File file = dir.openNextFile();
+ while(file) {
+
+ if(file.isDirectory()) {
+ explorerDeleteDirectory(file);
+ } else {
+ FSystem.remove(file.name());
+ }
+
+ file = dir.openNextFile();
+
+ esp_task_wdt_reset();
+ }
+
+ return FSystem.rmdir(dir.name());
+
+}
+
// Handles delete request of a file or directory
// requires a GET parameter path to the file or directory
void explorerHandleDeleteRequest(AsyncWebServerRequest *request) {
File file;
- bool isDir;
AsyncWebParameter *param;
char asciiFilePath[256];
if(request->hasParam("path")){
@@ -3963,10 +3982,8 @@ void explorerHandleDeleteRequest(AsyncWebServerRequest *request) {
convertUtf8ToAscii(param->value(), asciiFilePath);
if(FSystem.exists(asciiFilePath)) {
file = FSystem.open(asciiFilePath);
- isDir = file.isDirectory();
- file.close();
- if(isDir) {
- if(FSystem.rmdir(asciiFilePath)) {
+ if(file.isDirectory()) {
+ if(explorerDeleteDirectory(file)) {
snprintf(logBuf, serialLoglength, "DELETE: %s deleted", asciiFilePath);
loggerNl(serialDebug, logBuf, LOGLEVEL_INFO);
} else {