Version bump, fix mime serve for files with no extensions

This commit is contained in:
simon987 2022-04-27 22:01:30 -04:00
parent f87de89275
commit c7b3d11a6d
2 changed files with 7 additions and 3 deletions

View File

@ -49,7 +49,7 @@
#include <ctype.h>
#include "git_hash.h"
#define VERSION "2.12.1"
#define VERSION "2.12.2"
static const char *const Version = VERSION;
#ifndef SIST_PLATFORM

View File

@ -285,8 +285,12 @@ void serve_file_from_disk(cJSON *json, index_t *idx, struct mg_connection *nc, s
"Accept-Ranges: bytes\r\nCache-Control: no-store\r\n",
name, strlen(ext) == 0 ? "" : ".", ext);
char mime_mapping[1024];
snprintf(mime_mapping, sizeof(mime_mapping), "%s=%s", ext, mime);
char mime_mapping[8192];
if (strlen(ext) == 0) {
snprintf(mime_mapping, sizeof(mime_mapping), "%s=%s", full_path, mime);
} else {
snprintf(mime_mapping, sizeof(mime_mapping), "%s=%s", ext, mime);
}
struct mg_http_serve_opts opts = {
.extra_headers = disposition,