Explorar o código

Fix non photo url uploads

painor %!s(int64=3) %!d(string=hai) anos
pai
achega
20367c405a
Modificáronse 4 ficheiros con 7 adicións e 6 borrados
  1. 1 1
      gramjs/Version.ts
  2. 3 2
      gramjs/client/uploads.ts
  3. 2 2
      package-lock.json
  4. 1 1
      package.json

+ 1 - 1
gramjs/Version.ts

@@ -1 +1 @@
-export const version = "1.8.9";
+export const version = "1.8.10";

+ 3 - 2
gramjs/client/uploads.ts

@@ -260,7 +260,7 @@ async function _fileToMedia(
         return { fileHandle: undefined, media: undefined, image: undefined };
     }
     const isImage = utils.isImage(file);
-    console.log("as image?", isImage);
+
     if (asImage == undefined) {
         asImage = isImage && !forceDocument;
     }
@@ -305,7 +305,7 @@ async function _fileToMedia(
         if (asImage) {
             media = new Api.InputMediaPhotoExternal({ url: file });
         } else {
-            media = new Api.InputMediaPhotoExternal({ url: file });
+            media = new Api.InputMediaDocumentExternal({ url: file });
         }
     } else if (!(typeof file == "string") || (await fs.lstat(file)).isFile()) {
         if (typeof file == "string") {
@@ -473,6 +473,7 @@ export async function sendFile(
         supportsStreaming: supportsStreaming,
         workers: workers,
     });
+    console.log({ fileHandle, media, image })
     if (media == undefined) {
         throw new Error(`Cannot use ${file} as file.`);
     }

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "telegram",
-  "version": "1.8.9",
+  "version": "1.8.10",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "telegram",
-      "version": "1.8.9",
+      "version": "1.8.10",
       "license": "MIT",
       "dependencies": {
         "@cryptography/aes": "^0.1.1",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "telegram",
-  "version": "1.8.9",
+  "version": "1.8.10",
   "description": "NodeJS/Browser MTProto API Telegram client library,",
   "main": "index.js",
   "types": "index.d.ts",