Unverified Commit 9f08cf47 authored by Matthias Hertel's avatar Matthias Hertel Committed by GitHub

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()));
parent 96a5ddcd
......@@ -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();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment