From ab6ba9645e8d55b05c843e2cd1c2f77b61c129a4 Mon Sep 17 00:00:00 2001 From: Moritz Scholjegerdes Date: Tue, 2 Jul 2024 00:53:07 +0200 Subject: [PATCH 1/2] fix reset button in example 02 This fix was suggested by Frank-Bemelman --- example-02/webpages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-02/webpages.h b/example-02/webpages.h index a7dae15..f471a36 100644 --- a/example-02/webpages.h +++ b/example-02/webpages.h @@ -26,7 +26,7 @@ function logoutButton() { setTimeout(function(){ window.open("/logged-out","_self"); }, 1000); } function rebootButton() { - document.getElementById("statusdetails").innerHTML = "Invoking Reboot ..."; + document.getElementById("details").innerHTML = "Invoking Reboot ..."; var xhr = new XMLHttpRequest(); xhr.open("GET", "/reboot", true); xhr.send(); From d2ca8fc7c14511596b734e6b701b1839d7103021 Mon Sep 17 00:00:00 2001 From: Moritz Scholjegerdes Date: Tue, 2 Jul 2024 01:00:04 +0200 Subject: [PATCH 2/2] fix Files could neither be deleted nor downloaded - example 2 The fix was suggested by rtek1000 in the Issues --- example-02/webserver.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example-02/webserver.ino b/example-02/webserver.ino index 2b3544e..be6b426 100644 --- a/example-02/webserver.ino +++ b/example-02/webserver.ino @@ -96,17 +96,17 @@ void configureWebServer() { logmessage = "Client:" + request->client()->remoteIP().toString() + " " + request->url() + "?name=" + String(fileName) + "&action=" + String(fileAction); - if (!SPIFFS.exists(fileName)) { + if (!SPIFFS.exists(String('/') + fileName)) { Serial.println(logmessage + " ERROR: file does not exist"); request->send(400, "text/plain", "ERROR: file does not exist"); } else { Serial.println(logmessage + " file exists"); if (strcmp(fileAction, "download") == 0) { logmessage += " downloaded"; - request->send(SPIFFS, fileName, "application/octet-stream"); + request->send(SPIFFS, String('/') + fileName, "application/octet-stream"); } else if (strcmp(fileAction, "delete") == 0) { logmessage += " deleted"; - SPIFFS.remove(fileName); + SPIFFS.remove(String('/') + fileName); request->send(200, "text/plain", "Deleted File: " + String(fileName)); } else { logmessage += " ERROR: invalid action param supplied";