Skip to content

Commit 94a7f63

Browse files
author
Me No Dev
committed
fix static handler
1 parent 0063d80 commit 94a7f63

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ class StaticRequestHandler : public RequestHandler {
7070
if (!requestUri.startsWith(_uri))
7171
return false;
7272

73-
if (requestUri != _uri)
74-
return false;
75-
7673
return true;
7774
}
7875

@@ -91,6 +88,11 @@ class StaticRequestHandler : public RequestHandler {
9188
// URI in request to get the file path.
9289
path += requestUri.substring(_baseUriLength);
9390
}
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+
}
9496
DEBUGV("StaticRequestHandler::handle: path=%s, isFile=%d\r\n", path.c_str(), _isFile);
9597

9698
String contentType = getContentType(path);

0 commit comments

Comments
 (0)