From ef0891ae5dbcf0b5d0470422c8003f09b66cf7bd Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 20 Dec 2020 20:09:17 -0800 Subject: [PATCH] Fix for #576 - The browser was seeing the other files on the filesystem. --- src/meshwifi/meshhttp.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/meshwifi/meshhttp.cpp b/src/meshwifi/meshhttp.cpp index 1af531129..ebff1e7b8 100644 --- a/src/meshwifi/meshhttp.cpp +++ b/src/meshwifi/meshhttp.cpp @@ -405,16 +405,16 @@ void handleSpiffsBrowseStatic(HTTPRequest *req, HTTPResponse *res) res->print("\"files\": ["); bool firstFile = 1; while (file) { - if (firstFile) { - firstFile = 0; - } else { - res->println(","); - } - - res->println("{"); - String filePath = String(file.name()); if (filePath.indexOf("/static") == 0) { + if (firstFile) { + firstFile = 0; + } else { + res->println(","); + } + + res->println("{"); + if (String(file.name()).substring(1).endsWith(".gz")) { String modifiedFile = String(file.name()).substring(1); modifiedFile.remove((modifiedFile.length() - 3), 3); @@ -425,10 +425,10 @@ void handleSpiffsBrowseStatic(HTTPRequest *req, HTTPResponse *res) res->print("\"name\": \"" + String(file.name()).substring(1) + "\","); } res->print("\"size\": " + String(file.size())); + res->print("}"); } file = root.openNextFile(); - res->print("}"); } res->print("],"); res->print("\"filesystem\" : {");