Skip to content

Commit

Permalink
support: download file without extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed May 6, 2021
1 parent ae37011 commit 865dec7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/cinatra/http_router.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ class http_router {
pair.second(req, res);
return true;
} else {
if (url.rfind(DOT) != std::string_view::npos) {
bool is_wild_card = get_wildcard_function(url, req, res);
if (!is_wild_card) {
url = STATIC_RESOURCE;
return route(method, url, req, res);
}

return get_wildcard_function(url, req, res);
return is_wild_card;
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/cinatra/http_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class http_server_ : private noncopyable {
not_found_(req, res);
return;
}
res.set_status_and_content(status_type::not_found, "");
res.set_status_and_content(status_type::not_found, std::string(relative_file_name) + " not found");
return;
}

Expand Down

0 comments on commit 865dec7

Please sign in to comment.