Skip to content

Commit

Permalink
Improve LittleFS support (#7071)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JasperHorn authored Feb 23, 2020
1 parent 16319da commit d990ff9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
else {
_isFile = false;
}

DEBUGV("StaticRequestHandler: path=%s uri=%s isFile=%d, cache_header=%s\r\n", path, uri, _isFile, cache_header);
_baseUriLength = _uri.length();
}
Expand Down Expand Up @@ -134,6 +134,11 @@ class StaticRequestHandler : public RequestHandler<ServerType> {
if (!f)
return false;

if (!f.isFile()) {
f.close();
return false;
}

if (_cache_header.length() != 0)
server.sendHeader("Cache-Control", _cache_header);

Expand Down

0 comments on commit d990ff9

Please sign in to comment.