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) -> process_publish(Packet = ?PUBLISH_PACKET(QoS, Topic, PacketId), Channel) ->
?SLOG(
warning,
#{
packet => Packet,
packet_id => PacketId
}
),
case case
pipeline( pipeline(
[ [

View File

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

View File

@ -245,8 +245,19 @@ request_fun(HttpPool) ->
ehttpc_request(HttpPool, Method, Request, Timeout) -> ehttpc_request(HttpPool, Method, Request, Timeout) ->
try ehttpc:request(HttpPool, Method, Request, Timeout) of try ehttpc:request(HttpPool, Method, Request, Timeout) of
{ok, StatusCode, RespHeaders} -> {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, undefined}, erlcloud_string_headers(RespHeaders), undefined}};
{ok, StatusCode, RespHeaders, RespBody} -> {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}}; {ok, {{StatusCode, undefined}, erlcloud_string_headers(RespHeaders), RespBody}};
{error, Reason} -> {error, Reason} ->
?SLOG(error, #{ ?SLOG(error, #{