Skip to content

Commit d990ff9

Browse files
authored
Improve LittleFS support (#7071)
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 16319da commit d990ff9

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
@@ -80,7 +80,7 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
8080
else {
8181
_isFile = false;
8282
}
83-
83+
8484
DEBUGV("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header);
8585
_baseUriLength = _uri.length();
8686
}
@@ -134,6 +134,11 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
134134
if (!f)
135135
return false;
136136

137+
if (!f.isFile()) {
138+
f.close();
139+
return false;
140+
}
141+
137142
if (_cache_header.length() != 0)
138143
server.sendHeader("Cache-Control", _cache_header);
139144

0 commit comments

Comments
 (0)