Skip to content

Commit

Permalink
Merge pull request esp8266#405 from me-no-dev/esp8266-sdk-1.0
Browse files Browse the repository at this point in the history
fix sd example returning bad json on empty folder
  • Loading branch information
igrr committed Jun 11, 2015
2 parents 297df29 + b3ff6b5 commit d218c4e
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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\":\"";
Expand Down

0 comments on commit d218c4e

Please sign in to comment.