mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
fix sd example returning bad json on empty folder
This commit is contained in:
parent
09c88adb18
commit
fe562e6785
@ -184,15 +184,14 @@ void printDirectory() {
|
|||||||
server.send(200, "text/json", "");
|
server.send(200, "text/json", "");
|
||||||
WiFiClient client = server.client();
|
WiFiClient client = server.client();
|
||||||
|
|
||||||
|
server.sendContent("[");
|
||||||
for (int cnt = 0; true; ++cnt) {
|
for (int cnt = 0; true; ++cnt) {
|
||||||
File entry = dir.openNextFile();
|
File entry = dir.openNextFile();
|
||||||
if (!entry)
|
if (!entry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
String output;
|
String output;
|
||||||
if (cnt == 0)
|
if (cnt > 0)
|
||||||
output = '[';
|
|
||||||
else
|
|
||||||
output = ',';
|
output = ',';
|
||||||
|
|
||||||
output += "{\"type\":\"";
|
output += "{\"type\":\"";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user