Skip to content

Commit 38b707a

Browse files
jmikolakevinAlbs
authored andcommitted
CDRIVER-3958 add trailing space after base64 JSON field (#779)
1 parent c10c34e commit 38b707a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/libbson/src/bson/bson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ _bson_as_json_visit_binary (const bson_iter_t *iter,
27172717

27182718
if (state->mode == BSON_JSON_MODE_CANONICAL ||
27192719
state->mode == BSON_JSON_MODE_RELAXED) {
2720-
bson_string_append (state->str, "{ \"$binary\" : { \"base64\": \"");
2720+
bson_string_append (state->str, "{ \"$binary\" : { \"base64\" : \"");
27212721
bson_string_append (state->str, b64);
27222722
bson_string_append (state->str, "\", \"subType\" : \"");
27232723
bson_string_append_printf (state->str, "%02x", v_subtype);

src/libbson/tests/test-bson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ test_bson_as_json_string (void)
24712471
const char *expected =
24722472
"{ \"double\" : { \"$numberDouble\" : \"1.0\" }, \"string\" : "
24732473
"\"string_example\", \"document\" : { \"x\" : \"y\" }, \"document\" : [ "
2474-
"\"x\" ], \"binary\" : { \"$binary\" : { \"base64\": \"ZGF0YQ==\", "
2474+
"\"x\" ], \"binary\" : { \"$binary\" : { \"base64\" : \"ZGF0YQ==\", "
24752475
"\"subType\" : \"00\" } }, \"undefined\" : { \"$undefined\" : true }, "
24762476
"\"oid\" : { \"$oid\" : \"000000000000000000000000\" }, \"bool\" : true, "
24772477
"\"datetime\" : { \"$date\" : { \"$numberLong\" : \"123\" } }, \"null\" "

src/libbson/tests/test-json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,12 +2976,12 @@ test_bson_as_json_with_opts_binary (void)
29762976

29772977
run_bson_as_json_with_opts_tests (b,
29782978
BSON_JSON_MODE_CANONICAL,
2979-
"{ \"v\" : { \"$binary\" : { \"base64\": "
2979+
"{ \"v\" : { \"$binary\" : { \"base64\" : "
29802980
"\"AQIDBA==\", \"subType\" : \"00\" } } }");
29812981

29822982
run_bson_as_json_with_opts_tests (b,
29832983
BSON_JSON_MODE_RELAXED,
2984-
"{ \"v\" : { \"$binary\" : { \"base64\": "
2984+
"{ \"v\" : { \"$binary\" : { \"base64\" : "
29852985
"\"AQIDBA==\", \"subType\" : \"00\" } } }");
29862986

29872987
bson_destroy (b);

0 commit comments

Comments
 (0)