Skip to content

Commit

Permalink
gateway: Fix #845
Browse files Browse the repository at this point in the history
  • Loading branch information
mocchira committed Oct 4, 2017
1 parent 913dc98 commit ee3efbc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/leo_gateway/src/leo_gateway_s3_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1192,16 +1192,19 @@ handle_multi_upload_1(true, Req, Path, UploadId,

case leo_gateway_rpc_handler:get(Path4Conf) of
{ok, #?METADATA{meta = CMetaBin}, _} ->
_ = leo_gateway_rpc_handler:delete(Path4Conf),

BodyOpts = case TransferDecodeFun of
undefined ->
[];
_ ->
[{transfer_decode, TransferDecodeFun, TransferDecodeState}]
end,
Ret = cowboy_req:body(Req, BodyOpts),
handle_multi_upload_2(Ret, Req, Path, ChunkedLen, BucketInfo, CMetaBin);
{ok, Req2} = handle_multi_upload_2(Ret, Req, Path, ChunkedLen, BucketInfo, CMetaBin),
%% Deleting a temporary object after getting the upload done could decrease the odds
%% inconsistencies against the temporary object could happen.
%% This hack should mitigate https://github.com/leo-project/leofs/issues/845
_ = leo_gateway_rpc_handler:delete(Path4Conf),
{ok, Req2};
_ ->
?reply_service_unavailable_error([?SERVER_HEADER], Path, <<>>, Req)
end;
Expand Down

0 comments on commit ee3efbc

Please sign in to comment.