Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

consider Offset when computing truncation point

If Offset is ignored, the file will be truncated incorrectly after POST.
  • Loading branch information...
commit b1b6cd181fee907392bcf1ee744a1796448a1c37 1 parent 552ac5e
Bryan Fink beerriot authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/luwak_wm_file.erl
4 src/luwak_wm_file.erl
View
@@ -531,8 +531,8 @@ accept_streambody(RD, #ctx{handle={ok, H}, client=C, method=Method}) ->
{H2, Count} = accept_streambody1(Stream, 0, wrq:stream_req_body(RD, Size)),
H2Len = luwak_file:length(C, H2),
%% truncate will fail if passed a Start >= the length of the file
- if Count < H2Len ->
- {ok, _} = luwak_io:truncate(C, H2, Count),
+ if Offset+Count < H2Len ->
+ {ok, _} = luwak_io:truncate(C, H2, Offset+Count),
true;
true -> true
end.
Please sign in to comment.
Something went wrong with that request. Please try again.