File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3535#ifdef COSMOCC
3636#include < cosmo.h>
3737#endif
38+
39+ bool ends_with (std::string const &fullString, std::string const &ending);
40+ bool ends_with (std::string const &fullString, std::string const &ending) {
41+ if (fullString.length () >= ending.length ()) {
42+ return (0 == fullString.compare (fullString.length () - ending.length (), ending.length (), ending));
43+ }
44+ else {
45+ return false ;
46+ }
47+ }
3848// mmojo-server END
3949
4050using json = nlohmann::ordered_json;
@@ -3894,12 +3904,12 @@ int main(int argc, char ** argv) {
38943904
38953905 return false ;
38963906 };
3897-
3907+
38983908 auto middleware_server_state = [&res_error, &state](const httplib::Request & req, httplib::Response & res) {
38993909 server_state current_state = state.load ();
39003910 if (current_state == SERVER_STATE_LOADING_MODEL) {
39013911 auto tmp = string_split<std::string>(req.path , ' .' );
3902- if (req.path == " /" || tmp.back () == " html" || req.path . str . ends_with ( " /" ) || req.path . str . ends_with ( " .html" )) {
3912+ if (req.path == " /" || tmp.back () == " html" || ends_with ( req.path , " /" ) || ends_with ( req.path , " .html" )) {
39033913 // mmojo-server START
39043914 // res.set_content(reinterpret_cast<const char*>(loading_html), loading_html_len, "text/html; charset=utf-8");
39053915 res.set_content (reinterpret_cast <const char *>(loading_mmojo_html), loading_mmojo_html_len, " text/html; charset=utf-8" );
You can’t perform that action at this time.
0 commit comments