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:
parent
96a5ddcd0e
commit
9f08cf4767
1 changed files with 2 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue