Skip to content

Commit bc48022

Browse files
author
Me No Dev
committed
spend more time understanding the logic
1 parent 94a7f63 commit bc48022

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class StaticRequestHandler : public RequestHandler {
6767
if (requestMethod != HTTP_GET)
6868
return false;
6969

70-
if (!requestUri.startsWith(_uri))
71-
return false;
70+
if (_isFile && requestUri != _uri || !requestUri.startsWith(_uri))
71+
return false;
7272

7373
return true;
7474
}
@@ -88,11 +88,6 @@ class StaticRequestHandler : public RequestHandler {
8888
// URI in request to get the file path.
8989
path += requestUri.substring(_baseUriLength);
9090
}
91-
92-
else if (requestUri != _uri) {
93-
// Base URI points to a file but request doesn't match this URI exactly
94-
return false;
95-
}
9691
DEBUGV("StaticRequestHandler::handle: path=%s, isFile=%d\r\n", path.c_str(), _isFile);
9792

9893
String contentType = getContentType(path);

0 commit comments

Comments
 (0)