diff --git a/lib/WebServerHandlers/StaticPage.h b/lib/WebServerHandlers/StaticPage.h index 91894ec..0635a02 100644 --- a/lib/WebServerHandlers/StaticPage.h +++ b/lib/WebServerHandlers/StaticPage.h @@ -1,4 +1,7 @@ #include +#include + +using namespace mime; class StaticPage : public RequestHandler { public: @@ -61,6 +64,14 @@ public: } #endif + if (!this->path.endsWith(FPSTR(mimeTable[gz].endsWith)) && !this->fs->exists(path)) { + String pathWithGz = this->path + FPSTR(mimeTable[gz].endsWith); + + if (this->fs->exists(pathWithGz)) { + this->path += FPSTR(mimeTable[gz].endsWith); + } + } + File file = this->fs->open(this->path, "r"); if (!file) { return false; @@ -93,6 +104,6 @@ protected: BeforeSendCallback beforeSendCallback; String eTag; const char* uri = nullptr; - const char* path = nullptr; + String path; const char* cacheHeader = nullptr; }; \ No newline at end of file