fix(ft): handle wider class of jiffy decode errors
With malformed cursors in the File listing API. Fixes EMQX-9965
This commit is contained in:
parent
cb14a3e08b
commit
2dbf84479c
|
@ -422,7 +422,7 @@ decode_cursor(Cursor) ->
|
|||
true = is_list(Name),
|
||||
{Node, #{transfer => {ClientId, FileId}, name => Name}}
|
||||
catch
|
||||
error:{_, invalid_json} ->
|
||||
error:{Loc, JsonError} when is_integer(Loc), is_atom(JsonError) ->
|
||||
error({badarg, cursor});
|
||||
error:{badmatch, _} ->
|
||||
error({badarg, cursor});
|
||||
|
|
|
@ -216,6 +216,16 @@ t_list_files_paging(Config) ->
|
|||
request_json(get, uri(["file_transfer", "files"]) ++ query(#{limit => 0}))
|
||||
),
|
||||
|
||||
?assertMatch(
|
||||
{ok, 400, #{<<"code">> := <<"BAD_REQUEST">>}},
|
||||
request_json(get, uri(["file_transfer", "files"]) ++ query(#{following => <<>>}))
|
||||
),
|
||||
|
||||
?assertMatch(
|
||||
{ok, 400, #{<<"code">> := <<"BAD_REQUEST">>}},
|
||||
request_json(get, uri(["file_transfer", "files"]) ++ query(#{following => <<"{\"\":}">>}))
|
||||
),
|
||||
|
||||
?assertMatch(
|
||||
{ok, 400, #{<<"code">> := <<"BAD_REQUEST">>}},
|
||||
request_json(
|
||||
|
|
Loading…
Reference in New Issue