Skip to content

Commit

Permalink
fix wrong MIME type for custom 404
Browse files Browse the repository at this point in the history
  • Loading branch information
scaprile committed Feb 20, 2024
1 parent 93148e3 commit 1c114a2
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 1c114a2

Please sign in to comment.