Bladeren bron

Change the way of getting extensions from local files.

painor 3 jaren geleden
bovenliggende
commit
23a9c1e6f3
4 gewijzigde bestanden met toevoegingen van 5 en 7 verwijderingen
  1. 1 3
      gramjs/Utils.ts
  2. 1 1
      gramjs/Version.ts
  3. 2 2
      package-lock.json
  4. 1 1
      package.json

+ 1 - 3
gramjs/Utils.ts

@@ -634,10 +634,8 @@ export function getExtension(media: any): string {
  * str or an ``open()``'ed file (which has a ``.name`` attribute).
  * str or an ``open()``'ed file (which has a ``.name`` attribute).
  */
  */
 function _getExtension(file: any): string {
 function _getExtension(file: any): string {
-    var kind;
     if (typeof file === "string") {
     if (typeof file === "string") {
-        // thanks Stackoverflow
-        return file.slice(((file.lastIndexOf(".") - 2) >>> 0) + 2);
+        return "."+file.split('.').pop();
     } else if ("name" in file) {
     } else if ("name" in file) {
         return _getExtension(file.name);
         return _getExtension(file.name);
     } else {
     } else {

+ 1 - 1
gramjs/Version.ts

@@ -1 +1 @@
-export const version = "2.4.0";
+export const version = "2.4.1";

+ 2 - 2
package-lock.json

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

+ 1 - 1
package.json

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