Skip to content

Commit

Permalink
Merge pull request #43 from ferd/fix-multipart-crashes
Browse files Browse the repository at this point in the history
Fix multipart failures
  • Loading branch information
ferd authored Jul 29, 2024
2 parents 9a1d9cf + 64bf823 commit 1b83d5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/revault/src/revault_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,9 @@ format_status(Status) ->
format_status_msg({info, {revault, Marker, {file, F, Meta, Bin}}}) when byte_size(Bin) > 64 ->
BinSize = integer_to_binary(byte_size(Bin)),
{revault, Marker, {file, F, Meta, <<"[truncated: ", BinSize/binary, " bytes]">>}};
format_status_msg({info, {revault, Marker, {file, F, Meta, PartNum, PartTotal, Bin}}}) when byte_size(Bin) > 64 ->
BinSize = integer_to_binary(byte_size(Bin)),
{revault, Marker, {file, F, Meta, PartNum, PartTotal, <<"[truncated: ", BinSize/binary, " bytes]">>}};
format_status_msg(Term) -> Term.

%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -1137,6 +1140,7 @@ handle_multipart_file(MPState, F, Hash, PartNum, PartTotal, Bin) when PartNum ==
%% use an unpredictable rand file since this may be one of many incidentally
%% conflicting files sharing the same name, even if unlikely. Better to protect
%% against overlapping runs.
ok = revault_file:ensure_dir(F),
State = revault_file:multipart_init(F, PartTotal, Hash),
{ok, NewState} = revault_file:multipart_update(State, F, PartNum, PartTotal, Hash, Bin),
{new, MPState#{F => NewState}};
Expand Down

0 comments on commit 1b83d5f

Please sign in to comment.