fix(ft-s3): fix s3 listing

This commit is contained in:
Ilya Averyanov 2023-04-04 17:12:52 +03:00
parent 7d13862da5
commit d7a85242de
3 changed files with 15 additions and 8 deletions

View File

@ -641,13 +641,6 @@ process_connect(
%%--------------------------------------------------------------------
process_publish(Packet = ?PUBLISH_PACKET(QoS, Topic, PacketId), Channel) ->
?SLOG(
warning,
#{
packet => Packet,
packet_id => PacketId
}
),
case
pipeline(
[

View File

@ -155,7 +155,7 @@ list_key_info(Client, Options, Marker, Acc) ->
KeyInfos = proplists:get_value(contents, Result, []),
case proplists:get_value(is_truncated, Result, false) of
true ->
NewMarker = [{marker, proplists:get_value(next_marker, Result)}],
NewMarker = next_marker(KeyInfos),
list_key_info(Client, Options, NewMarker, [KeyInfos | Acc]);
false ->
{ok, lists:append(lists:reverse([KeyInfos | Acc]))}
@ -164,6 +164,9 @@ list_key_info(Client, Options, Marker, Acc) ->
Error
end.
next_marker(KeyInfos) ->
[{marker, proplists:get_value(key, lists:last(KeyInfos))}].
key_info_to_exportinfo(Client, KeyInfo, _Options) ->
Key = proplists:get_value(key, KeyInfo),
{Transfer, Name} = parse_transfer_and_name(Key),

View File

@ -245,8 +245,19 @@ request_fun(HttpPool) ->
ehttpc_request(HttpPool, Method, Request, Timeout) ->
try ehttpc:request(HttpPool, Method, Request, Timeout) of
{ok, StatusCode, RespHeaders} ->
?SLOG(debug, #{
msg => "s3_ehttpc_request_ok",
status_code => StatusCode,
headers => RespHeaders
}),
{ok, {{StatusCode, undefined}, erlcloud_string_headers(RespHeaders), undefined}};
{ok, StatusCode, RespHeaders, RespBody} ->
?SLOG(debug, #{
msg => "s3_ehttpc_request_ok",
status_code => StatusCode,
headers => RespHeaders,
body => RespBody
}),
{ok, {{StatusCode, undefined}, erlcloud_string_headers(RespHeaders), RespBody}};
{error, Reason} ->
?SLOG(error, #{