Skip to content

Commit 177963e

Browse files
kaetemidsx1986
authored andcommitted
server : fix crash when error handler dumps invalid utf-8 json (ggml-org#9195)
1 parent 77c5436 commit 177963e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/server/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2572,7 +2572,7 @@ int main(int argc, char ** argv) {
25722572

25732573
auto res_error = [](httplib::Response & res, json error_data) {
25742574
json final_response {{"error", error_data}};
2575-
res.set_content(final_response.dump(), MIMETYPE_JSON);
2575+
res.set_content(final_response.dump(-1, ' ', false, json::error_handler_t::replace), MIMETYPE_JSON);
25762576
res.status = json_value(error_data, "code", 500);
25772577
};
25782578

0 commit comments

Comments
 (0)