diff --git a/apps/emqx_management/src/emqx_mgmt_api_clients.erl b/apps/emqx_management/src/emqx_mgmt_api_clients.erl index 9175f91ff..ee8e182bd 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_clients.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_clients.erl @@ -1088,7 +1088,7 @@ next_ds_cursor(Iter) -> }. parse_cursor(CursorBin, Nodes) -> - try base64:decode(CursorBin, #{mode => urlsafe, padding => false}) of + try emqx_base62:decode(CursorBin) of Bin -> parse_cursor1(Bin, Nodes) catch @@ -1133,11 +1133,11 @@ serialize_cursor(#{type := ?CURSOR_TYPE_ETS, node_idx := NodeIdx, cont := Cont}) #{?CURSOR_ETS_NODE_IDX => NodeIdx, ?CURSOR_ETS_CONT => Cont} ], Bin = term_to_binary(Cursor0, [{compressed, 9}]), - base64:encode(Bin, #{mode => urlsafe, padding => false}); + emqx_base62:encode(Bin); serialize_cursor(#{type := ?CURSOR_TYPE_DS, iterator := Iter}) -> Cursor0 = [?CURSOR_VSN1, ?CURSOR_TYPE_DS, Iter], Bin = term_to_binary(Cursor0, [{compressed, 9}]), - base64:encode(Bin, #{mode => urlsafe, padding => false}). + emqx_base62:encode(Bin). %% An adapter function so we can reutilize all the logic in `emqx_mgmt_api' for %% selecting/fuzzy filters, and also reutilize its BPAPI for selecting rows. diff --git a/apps/emqx_management/test/emqx_mgmt_api_clients_SUITE.erl b/apps/emqx_management/test/emqx_mgmt_api_clients_SUITE.erl index ebda34bc2..2623e6d4d 100644 --- a/apps/emqx_management/test/emqx_mgmt_api_clients_SUITE.erl +++ b/apps/emqx_management/test/emqx_mgmt_api_clients_SUITE.erl @@ -1673,7 +1673,7 @@ t_list_clients_v2(Config) -> %% Verify that a malicious cursor that could generate an atom on the node is %% rejected EvilAtomBin0 = <<131, 100, 0, 5, "some_atom_that_doesnt_exist_on_the_remote_node">>, - EvilAtomBin = base64:encode(EvilAtomBin0, #{mode => urlsafe, padding => false}), + EvilAtomBin = emqx_base62:encode(EvilAtomBin0), ?assertMatch( {error, {{_, 400, _}, _, #{<<"message">> := <<"bad cursor">>}}},