diff --git a/src/AsyncWebServerHandlerImpl.h b/src/AsyncWebServerHandlerImpl.h index 9bb2ee7..a129f9b 100644 --- a/src/AsyncWebServerHandlerImpl.h +++ b/src/AsyncWebServerHandlerImpl.h @@ -26,11 +26,11 @@ class AsyncStaticWebHandler: public AsyncWebHandler { _isFile = _fs.exists(path) || _fs.exists((String(path)+".gz").c_str()); if (_uri != "/" && _uri.endsWith("/")) { _uri = _uri.substring(0, _uri.length() - 1); - DEBUGF("[AsyncStaticWebHandler] _uri / removed"); + DEBUGF("[AsyncStaticWebHandler] _uri / removed\n"); } if (_path != "/" && _path.endsWith("/")) { _path = _path.substring(0, _path.length() - 1); - DEBUGF("[AsyncStaticWebHandler] _path / removed"); + DEBUGF("[AsyncStaticWebHandler] _path / removed\n"); } diff --git a/src/ESPAsyncWebServer.h b/src/ESPAsyncWebServer.h index 67a34ad..fe2ca89 100644 --- a/src/ESPAsyncWebServer.h +++ b/src/ESPAsyncWebServer.h @@ -9,7 +9,7 @@ #include "StringArray.h" -#define DEBUGF(...) //os_printf(__VA_ARGS__) +#define DEBUGF(...) //Serial.printf(__VA_ARGS__) class AsyncWebServer; diff --git a/src/WebHandlers.cpp b/src/WebHandlers.cpp index 5f5b71d..ad11d73 100644 --- a/src/WebHandlers.cpp +++ b/src/WebHandlers.cpp @@ -30,10 +30,13 @@ void AsyncStaticWebHandler::handleRequest(AsyncWebServerRequest *request) String baserequestUrl = request->url().substring(_uri.length()); // this is the request - stored _uri... /espman/ DEBUGF(" baserequestUrl = %s\n", baserequestUrl.c_str()); - if (baserequestUrl.length()) { - path = _path + baserequestUrl; - DEBUGF(" baserequestUrl length > 0: path = path + baserequestUrl, path = %s\n", path.c_str()); + if (!baserequestUrl.length()) { + baserequestUrl += "/"; } + + path = _path + baserequestUrl; + DEBUGF(" path = path + baserequestUrl, path = %s\n", path.c_str()); + if (path.endsWith("/")) { DEBUGF(" 3 path ends with / : path = index.htm \n"); path += "index.htm";