Skip to content

Commit c5ab505

Browse files
committed
fix query body extension
1 parent 88cb8ec commit c5ab505

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/protocol/codec/message.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ int8_t _z_query_encode(_z_wbuf_t *wbf, const _z_msg_query_t *msg) {
404404
_z_bytes_encode_len(&msg->_ext_value.payload)));
405405
_Z_RETURN_IF_ERR(_z_encoding_prefix_encode(wbf, msg->_ext_value.encoding.prefix));
406406
_Z_RETURN_IF_ERR(_z_bytes_encode(wbf, &msg->_ext_value.encoding.suffix));
407-
_Z_RETURN_IF_ERR(_z_bytes_encode(wbf, &msg->_ext_value.payload));
407+
_Z_RETURN_IF_ERR(_z_bytes_val_encode(wbf, &msg->_ext_value.payload));
408408
}
409409
if (required_exts.consolidation) {
410410
uint8_t extheader = _Z_MSG_EXT_ENC_ZINT | _Z_MSG_EXT_FLAG_M | 0x02;
@@ -440,7 +440,8 @@ int8_t _z_query_decode_extensions(_z_msg_ext_t *extension, void *ctx) {
440440
_z_zbuf_t zbf = _z_zbytes_as_zbuf(extension->_body._zbuf._val);
441441
ret = _z_encoding_prefix_decode(&msg->_ext_value.encoding.prefix, &zbf);
442442
ret |= _z_bytes_decode(&msg->_ext_value.encoding.suffix, &zbf);
443-
ret |= _z_bytes_decode(&msg->_ext_value.payload, &zbf);
443+
_z_bytes_t bytes = _z_bytes_wrap((uint8_t *)_z_zbuf_start(&zbf), _z_zbuf_len(&zbf));
444+
_z_bytes_copy(&msg->_ext_value.payload, &bytes);
444445
break;
445446
}
446447
default:

0 commit comments

Comments
 (0)