Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/include/grpc_transcoding/path_matcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ void ExtractBindingsFromQueryParameters(
// Make sure the query parameter is not a system parameter (e.g.
// `api_key`) before adding the binding.
if (system_params.find(name) == std::end(system_params)) {
name = UrlUnescapeString(name,
UrlUnescapeSpec::kAllCharacters,
/*query_param_unescape_plus=*/false);
// The name of the parameter is a field path, which is a dot-delimited
// sequence of field names that identify the (potentially deep) field
// in the request, e.g. `book.author.name`.
Expand Down
6 changes: 6 additions & 0 deletions test/path_matcher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,12 @@ TEST_F(PathMatcherTest, VariableBindingsWithQueryParamsEncoding) {
Binding{FieldPath{"x"}, "$%/ \n"},
}),
bindings);

EXPECT_EQ(LookupWithParams("GET", "/a", "shelf.search%5Bfield%5D=Hello%20world", &bindings), a);
EXPECT_EQ(Bindings({
Binding{FieldPath{"shelf","search[field]"}, "Hello world"},
}),
bindings);
}

TEST_F(PathMatcherTest, QueryParameterNotUnescapePlus) {
Expand Down