forked from me-no-dev/ESPAsyncWebServer
fix broken send of gzipped files
This commit is contained in:
@@ -357,14 +357,15 @@ void AsyncFileResponse::_setContentType(String path){
|
|||||||
AsyncFileResponse::AsyncFileResponse(FS &fs, String path, String contentType, bool download){
|
AsyncFileResponse::AsyncFileResponse(FS &fs, String path, String contentType, bool download){
|
||||||
_code = 200;
|
_code = 200;
|
||||||
_path = path;
|
_path = path;
|
||||||
_content = fs.open(_path, "r");
|
|
||||||
_contentLength = _content.size();
|
|
||||||
|
|
||||||
if(!download && !fs.exists(_path) && fs.exists(_path+".gz")){
|
if(!download && !fs.exists(_path) && fs.exists(_path+".gz")){
|
||||||
_path = _path+".gz";
|
_path = _path+".gz";
|
||||||
addHeader("Content-Encoding", "gzip");
|
addHeader("Content-Encoding", "gzip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_content = fs.open(_path, "r");
|
||||||
|
_contentLength = _content.size();
|
||||||
|
|
||||||
if(contentType == "")
|
if(contentType == "")
|
||||||
_setContentType(path);
|
_setContentType(path);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user