Skip to content

Commit 868b53c

Browse files
committed
Improve LittleFS support
Previously, when the path was a directory, but didn't have a slash at the end, a 0 byte response would be sent when using LittleFS. Now, it will return a 404, like was always the case when using SPIFFS.
1 parent dbd7b82 commit 868b53c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
7878
else {
7979
_isFile = false;
8080
}
81-
81+
8282
DEBUGV("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header);
8383
_baseUriLength = _uri.length();
8484
}
@@ -132,6 +132,11 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
132132
if (!f)
133133
return false;
134134

135+
if (!f.isFile()) {
136+
f.close();
137+
return false;
138+
}
139+
135140
if (_cache_header.length() != 0)
136141
server.sendHeader("Cache-Control", _cache_header);
137142

0 commit comments

Comments
 (0)