diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c3eb7306..25f9783e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,6 +156,7 @@ jobs: ./dragonfly_test ./multi_test --multi_exec_mode=1 ./multi_test --multi_exec_mode=3 + ./json_family_test --jsonpathv2=false - name: Upload unit logs on failure if: failure() diff --git a/src/server/json_family.cc b/src/server/json_family.cc index f80b44731..2330df0a1 100644 --- a/src/server/json_family.cc +++ b/src/server/json_family.cc @@ -1447,10 +1447,16 @@ io::Result ParsePathV2(string_view path) { } if (absl::GetFlag(FLAGS_jsonpathv2)) { - return json::ParsePath(path); + auto path_result = json::ParsePath(path); + if (!path_result) { + VLOG(1) << "Invalid Json path: " << path << ' ' << path_result.error() << std::endl; + return nonstd::make_unexpected(kSyntaxErr); + } + return path_result; } io::Result expr_result = ParseJsonPath(path); if (!expr_result) { + VLOG(1) << "Invalid Json path: " << path << ' ' << expr_result.error() << std::endl; return nonstd::make_unexpected(kSyntaxErr); } return JsonPathV2(std::move(expr_result.value())); diff --git a/src/server/json_family_test.cc b/src/server/json_family_test.cc index ed0b55dd1..dc6166850 100644 --- a/src/server/json_family_test.cc +++ b/src/server/json_family_test.cc @@ -982,7 +982,7 @@ TEST_F(JsonFamilyTest, MGet) { #ifndef SANITIZERS resp = Run({"JSON.MGET", "json1", "??INNNNVALID??"}); - EXPECT_THAT(resp, ErrArg("Unknown token")); + EXPECT_THAT(resp, ErrArg("ERR syntax error")); #endif resp = Run({"JSON.MGET", "json1", "json2", "json3", "$.address.country"});