Skip to content

Commit 08d7853

Browse files
EtronieDENGpymumu
authored andcommitted
UI: fix missing graph file name bug
1 parent 51004a9 commit 08d7853

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/modelbox/server/plugin/editor/editor_plugin.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,28 @@ void ModelboxEditorPlugin::HandlerProjectGet(const httplib::Request& request,
431431
nlohmann::json graph;
432432
for (const auto &g : graphs) {
433433
ret = GraphFileToJson(g, json_data);
434-
graph["name"] = modelbox::GetBaseName(g);
434+
if (!ret) {
435+
modelbox::Status rspret = {ret, "graph toml"};
436+
SetUpResponse(response, rspret);
437+
return;
438+
}
435439
graph = nlohmann::json::parse(json_data);
440+
graph["name"] = modelbox::GetBaseName(g);
436441
json["graphs"].push_back(graph);
437442
}
438443

439444
std::vector<std::string> flowunits;
440445
ret = modelbox::ListSubDirectoryFiles(flowunit_path, "*.toml", &flowunits);
446+
if (!ret) {
447+
modelbox::Status ret = {modelbox::STATUS_NOTFOUND,
448+
HTTP_RESP_ERR_CANNOT_READ};
449+
SetUpResponse(response, ret);
450+
return;
451+
}
441452
for (const auto &f : flowunits) {
442453
ret = GraphFileToJson(f, json_data);
443454
if (!ret) {
444-
modelbox::Status rspret = {ret, "toml"};
455+
modelbox::Status rspret = {ret, "flowunit toml"};
445456
SetUpResponse(response, rspret);
446457
return;
447458
}

0 commit comments

Comments
 (0)