Skip to content

Commit

Permalink
Fixed jlouis#21 in original repo
Browse files Browse the repository at this point in the history
  • Loading branch information
T0ha committed Nov 14, 2013
1 parent 7db7f4e commit 188b15e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/etorrent_mktorrent.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ mk_comment(Comment) when is_list(Comment) ->

mk_infodict_single(PieceHashes, Name, Sz) when is_binary(PieceHashes) ->
[{<<"pieces">>, PieceHashes},
{<<"piece length">>, ?CHUNKSIZE},
if Sz < ?CHUNKSIZE ->
{<<"piece length">>, Sz};
true ->
{<<"piece length">>, ?CHUNKSIZE}
end,
{<<"name">>, list_to_binary(filename:basename(Name))},
{<<"length">>, Sz}].

Expand Down

0 comments on commit 188b15e

Please sign in to comment.