mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 21:41:01 +02:00
Update RequestHandlersImpl.h (#6179)
With LittleFS the `fs.exists(path)` returns true also on folders. A `isDirectory()` call is required to set _isFile to false on directories. This enables serving all files from a folder like : `server->serveStatic("/", LittleFS, "/", cacheHeader.c_str()); File f = fs.open(path); _isFile = (f && (! f.isDirectory()));
This commit is contained in:
@ -68,7 +68,8 @@ public:
|
||||
, _path(path)
|
||||
, _cache_header(cache_header)
|
||||
{
|
||||
_isFile = fs.exists(path);
|
||||
File f = fs.open(path);
|
||||
_isFile = (f && (! f.isDirectory()));
|
||||
log_v("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header ? cache_header : ""); // issue 5506 - cache_header can be nullptr
|
||||
_baseUriLength = _uri.length();
|
||||
}
|
||||
|
Reference in New Issue
Block a user