Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AsyncWebServerRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void AsyncWebServerRequest::send(FS &fs, const String &path, const char *content

// Handle compressed version
const String gzPath = path + asyncsrv::T__gz;
File gzFile = fs.open(gzPath, "r");
File gzFile = fs.open(gzPath, fs::FileOpenMode::read);

// Compressed file not found or invalid
if (!gzFile.seek(gzFile.size() - 8)) {
Expand Down
6 changes: 3 additions & 3 deletions src/WebResponses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ AsyncFileResponse::AsyncFileResponse(FS &fs, const String &path, const char *con
}
}

if (*contentType != '\0') {
if (*contentType == '\0') {
_setContentTypeFromPath(path);
} else {
_contentType = contentType;
Expand All @@ -745,11 +745,11 @@ AsyncFileResponse::AsyncFileResponse(FS &fs, const String &path, const char *con
int filenameStart = path.lastIndexOf('/') + 1;
char buf[26 + path.length() - filenameStart];
char *filename = (char *)path.c_str() + filenameStart;
snprintf_P(buf, sizeof(buf), PSTR("attachment; filename=\"%s\""), filename);
snprintf(buf, sizeof(buf), T_attachment, filename);
addHeader(T_Content_Disposition, buf, false);
} else {
// Serve file inline (display in browser)
addHeader(T_Content_Disposition, PSTR("inline"), false);
addHeader(T_Content_Disposition, T_inline, false);
}

_code = 200;
Expand Down
3 changes: 3 additions & 0 deletions src/literals.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace asyncsrv {

static constexpr const char *empty = "";

static const char T_inline[] = "inline";
static const char T_attachment[] = "attachment; filename=\"%s\"";

static constexpr const char *T__opaque = "\", opaque=\"";
static constexpr const char *T_100_CONTINUE = "100-continue";
static constexpr const char *T_13 = "13";
Expand Down