mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-02 11:55:56 +00:00
Fix for #576 - The browser was seeing the other files on the filesystem.
This commit is contained in:
parent
9ed19892e2
commit
ef0891ae5d
@ -405,16 +405,16 @@ void handleSpiffsBrowseStatic(HTTPRequest *req, HTTPResponse *res)
|
|||||||
res->print("\"files\": [");
|
res->print("\"files\": [");
|
||||||
bool firstFile = 1;
|
bool firstFile = 1;
|
||||||
while (file) {
|
while (file) {
|
||||||
if (firstFile) {
|
|
||||||
firstFile = 0;
|
|
||||||
} else {
|
|
||||||
res->println(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
res->println("{");
|
|
||||||
|
|
||||||
String filePath = String(file.name());
|
String filePath = String(file.name());
|
||||||
if (filePath.indexOf("/static") == 0) {
|
if (filePath.indexOf("/static") == 0) {
|
||||||
|
if (firstFile) {
|
||||||
|
firstFile = 0;
|
||||||
|
} else {
|
||||||
|
res->println(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
res->println("{");
|
||||||
|
|
||||||
if (String(file.name()).substring(1).endsWith(".gz")) {
|
if (String(file.name()).substring(1).endsWith(".gz")) {
|
||||||
String modifiedFile = String(file.name()).substring(1);
|
String modifiedFile = String(file.name()).substring(1);
|
||||||
modifiedFile.remove((modifiedFile.length() - 3), 3);
|
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("\"name\": \"" + String(file.name()).substring(1) + "\",");
|
||||||
}
|
}
|
||||||
res->print("\"size\": " + String(file.size()));
|
res->print("\"size\": " + String(file.size()));
|
||||||
|
res->print("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
file = root.openNextFile();
|
file = root.openNextFile();
|
||||||
res->print("}");
|
|
||||||
}
|
}
|
||||||
res->print("],");
|
res->print("],");
|
||||||
res->print("\"filesystem\" : {");
|
res->print("\"filesystem\" : {");
|
||||||
|
Loading…
Reference in New Issue
Block a user