소스 검색

Fix uploads from file path.

Painor 10 달 전
부모
커밋
273a6f498c
2개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      gramjs/Version.ts
  2. 9 1
      gramjs/client/uploads.ts

+ 1 - 1
gramjs/Version.ts

@@ -1 +1 @@
-export const version = "2.24.8";
+export const version = "2.25.0";

+ 9 - 1
gramjs/client/uploads.ts

@@ -155,7 +155,15 @@ export async function uploadFile(
         }
 
         for (let j = i; j < end; j++) {
-            const bytes = await buffer.slice(j * partSize, (j + 1) * partSize);
+            let endPart = (j + 1) * partSize;
+            if (endPart > size) {
+                endPart = size;
+            }
+            if (endPart == j * partSize) {
+                break;
+            }
+
+            const bytes = await buffer.slice(j * partSize, endPart);
 
             // eslint-disable-next-line no-loop-func
             sendingParts.push(