1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-27 21:16:50 +03:00

Fix serach order for index.htm(l)(.gz) files (#7069)

Fixes #6984

When a directory index is requested with an explicit index.html, follow
the original webserver order and check for: index.htm, index.htm.gz,
index.html, index.html.gz, in order.

Fixes the regressions introduced in 9f2cfb8 and 6768116
This commit is contained in:
Earle F. Philhower, III 2020-02-09 10:58:06 -08:00 committed by GitHub
parent 56b90a2abb
commit dbd7b8218d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,9 @@ public:
// Append whatever follows this URI in request to get the file path.
path += requestUri.substring(_baseUriLength);
if (!_fs.exists(path) && path.endsWith(".htm") && _fs.exists(path + "l")) {
// If neither <blah> nor <blah>.gz exist, and <blah> is a file.htm, try it with file.html instead
// For the normal case this will give a search order of index.htm, index.htm.gz, index.html, index.html.gz
if (!_fs.exists(path) && !_fs.exists(path + ".gz") && path.endsWith(".htm")) {
path += "l";
}
}