From 1c114a279e2139382effbb3bd1c3f13c2f24f39e Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 20 Feb 2024 19:08:07 -0300 Subject: [PATCH] fix wrong MIME type for custom 404 --- mongoose.c | 2 +- src/http.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 62fde56a..5d5a4348 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2787,8 +2787,8 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm, // Failed to open, and page404 is configured? Open it, then if (fd == NULL && opts->page404 != NULL) { fd = mg_fs_open(fs, opts->page404, MG_FS_READ); - mime = guess_content_type(mg_str(path), opts->mime_types); path = opts->page404; + mime = guess_content_type(mg_str(path), opts->mime_types); } if (fd == NULL || fs->st(path, &size, &mtime) == 0) { diff --git a/src/http.c b/src/http.c index ff76dfbf..680ec051 100644 --- a/src/http.c +++ b/src/http.c @@ -571,8 +571,8 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm, // Failed to open, and page404 is configured? Open it, then if (fd == NULL && opts->page404 != NULL) { fd = mg_fs_open(fs, opts->page404, MG_FS_READ); - mime = guess_content_type(mg_str(path), opts->mime_types); path = opts->page404; + mime = guess_content_type(mg_str(path), opts->mime_types); } if (fd == NULL || fs->st(path, &size, &mtime) == 0) {