Преглед на файлове

Fix `GenericDownloadIter` offset bug (#475)

`bad` variable should have been calculated with modulo not division. Fixes https://github.com/gram-js/gramjs/issues/465
Mohammad Momeni преди 2 години
родител
ревизия
78979a07a1
променени са 1 файла, в които са добавени 1 реда и са изтрити 3 реда
  1. 1 3
      gramjs/client/downloads.ts

+ 1 - 3
gramjs/client/downloads.ts

@@ -232,9 +232,7 @@ export class GenericDownloadIter extends DirectDownloadIter {
         let data = Buffer.alloc(0);
 
         //  1.1. ``bad`` is how much into the data we have we need to offset
-        const bad = this.request!.offset.divide(
-            this.request!.limit
-        ).toJSNumber();
+        const bad = this.request!.offset.mod(this.request!.limit).toJSNumber()
         const before = this.request!.offset;
 
         // 1.2. We have to fetch from a valid offset, so remove that bad part