fix broken send of gzipped files

This commit is contained in:
Me No Dev 2016-06-18 01:28:36 +03:00
parent 89b19e8cde
commit e46d4d7418
1 changed files with 8 additions and 7 deletions

View File

@ -357,14 +357,15 @@ void AsyncFileResponse::_setContentType(String path){
AsyncFileResponse::AsyncFileResponse(FS &fs, String path, String contentType, bool download){
_code = 200;
_path = path;
_content = fs.open(_path, "r");
_contentLength = _content.size();
if(!download && !fs.exists(_path) && fs.exists(_path+".gz")){
_path = _path+".gz";
addHeader("Content-Encoding", "gzip");
}
_content = fs.open(_path, "r");
_contentLength = _content.size();
if(contentType == "")
_setContentType(path);
else