From 67148de250af2050b7b049b827394ffde82ecce1 Mon Sep 17 00:00:00 2001 From: biver Date: Thu, 19 May 2022 09:48:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D1=83?= =?UTF-8?q?=20esp32=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B0=20=D1=80=D1=83=D1=87=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BD=D0=B0=D1=82=D1=81=D1=80=D0=BE=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/StandWebServer.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/StandWebServer.cpp b/src/StandWebServer.cpp index b13c0996..2445c9a1 100644 --- a/src/StandWebServer.cpp +++ b/src/StandWebServer.cpp @@ -204,14 +204,12 @@ void handleFileList() { HTTP.send(500, "text/plain", "BAD ARGS"); return; } - String path = HTTP.arg("list"); - Dir dir = FileFS.openDir(path); - path = String(); + File dir = FileFS.open(HTTP.arg("list"), "r"); String output = "["; - while (dir.next()) { - File entry = dir.openFile("r"); + File entry; + while (entry = dir.openNextFile()) { if (output != "[") output += ','; - bool isDir = dir.isDirectory(); + bool isDir = entry.isDirectory(); output += "{\"type\":\""; output += (isDir) ? "dir" : "file"; output += "\",\"name\":\"";