1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-07 06:01:35 +03:00

Wrap mimetype strings in FSPTR()s (#4338)

Mimetype is now in progmem, so any accesses to it need to be using FPSTR()
wrapped Strings.

Fixes #4329
This commit is contained in:
Earle F. Philhower, III
2018-02-10 08:12:38 -08:00
committed by GitHub
parent bf5a0f24dc
commit 291bc6bca5
2 changed files with 9 additions and 8 deletions

View File

@ -3,6 +3,7 @@
#include "RequestHandler.h"
#include "mimetable.h"
#include "WString.h"
using namespace mime;
@ -101,10 +102,10 @@ public:
// look for gz file, only if the original specified path is not a gz. So part only works to send gzip via content encoding when a non compressed is asked for
// if you point the the path to gzip you will serve the gzip as content type "application/x-gzip", not text or javascript etc...
if (!path.endsWith(mimeTable[gz].endsWith) && !_fs.exists(path)) {
String pathWithGz = path + mimeTable[gz].endsWith;
if (!path.endsWith(FPSTR(mimeTable[gz].endsWith)) && !_fs.exists(path)) {
String pathWithGz = path + FPSTR(mimeTable[gz].endsWith);
if(_fs.exists(pathWithGz))
path += mimeTable[gz].endsWith;
path += FPSTR(mimeTable[gz].endsWith);
}
File f = _fs.open(path, "r");