diff --git a/mongoose.c b/mongoose.c index 900fd175..4188d24a 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) {