Skip to content

Commit

Permalink
Merge pull request #2620 from cesanta/2617
Browse files Browse the repository at this point in the history
fix wrong MIME type for custom 404
  • Loading branch information
cpq authored Feb 23, 2024
2 parents 1743e17 + 1c114a2 commit f61f2d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f61f2d2

Please sign in to comment.