From 88b4f5454329a8ad5dcad805fce1997d46b7637c Mon Sep 17 00:00:00 2001 From: Shachar Itzhaky Date: Mon, 11 Mar 2019 16:44:15 +0200 Subject: [PATCH] Fixes #1515 and #1552. --- lib/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/file.js b/lib/file.js index e5624cd0..8bcfe22a 100644 --- a/lib/file.js +++ b/lib/file.js @@ -43,7 +43,7 @@ class File extends EventEmitter { // Calculate first piece diffrently, it sometimes have a offset let downloaded = bitfield.get(start) - ? pieceLength - this.offset + ? pieceLength - (this.offset % pieceLength) : Math.max(piece.length - piece.missing - this.offset, 0) for (let index = start + 1; index <= end; ++index) {