mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
download.py: don't truncate tail segments that are the same size as all the others
This commit is contained in:
parent
a0dc26ee11
commit
c3268ca394
@ -323,7 +323,10 @@ class FileDownloader:
|
|||||||
def _done(res):
|
def _done(res):
|
||||||
# trim off any padding added by the upload side
|
# trim off any padding added by the upload side
|
||||||
data = ''.join(res)
|
data = ''.join(res)
|
||||||
tail_size = self._size % self._segment_size
|
# we never send empty segments. If the data was an exact multiple
|
||||||
|
# of the segment size, the last segment will be full.
|
||||||
|
pad_size = mathutil.pad_size(self._size, self._segment_size)
|
||||||
|
tail_size = self._segment_size - pad_size
|
||||||
self._output.write(data[:tail_size])
|
self._output.write(data[:tail_size])
|
||||||
d.addCallback(_done)
|
d.addCallback(_done)
|
||||||
return d
|
return d
|
||||||
|
Loading…
Reference in New Issue
Block a user