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