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

Lines changed: 6 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy