Merge pull request #2620 from cesanta/2617

fix wrong MIME type for custom 404
This commit is contained in:
Sergey Lyubka 2024-02-23 01:50:02 +00:00 committed by GitHub
commit f61f2d2e9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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) {