Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"form-data": "^4.0.1",
"https-proxy-agent": "^7.0.6",
"i18next": "^23.7.19",
"jimp": "^0.16.13",
"jimp": "^1.6.0",
"json-schema": "^0.4.0",
"jsonschema": "^1.4.1",
"jsonwebtoken": "^9.0.2",
Expand All @@ -95,7 +95,7 @@
"qrcode": "^1.5.4",
"qrcode-terminal": "^0.12.0",
"redis": "^4.7.0",
"sharp": "^0.32.6",
"sharp": "^0.34.2",
"socket.io": "^4.8.1",
"socket.io-client": "^4.8.1",
"tsup": "^8.3.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import axios from 'axios';
import { proto } from 'baileys';
import dayjs from 'dayjs';
import FormData from 'form-data';
import Jimp from 'jimp';
import { Jimp, JimpMime } from 'jimp';
import Long from 'long';
import mimeTypes from 'mime-types';
import path from 'path';
Expand Down Expand Up @@ -2101,9 +2101,9 @@ export class ChatwootService {
const fileData = Buffer.from(imgBuffer.data, 'binary');

const img = await Jimp.read(fileData);
await img.cover(320, 180);
img.cover({ w: 320, h: 180 });

const processedBuffer = await img.getBufferAsync(Jimp.MIME_PNG);
const processedBuffer = await img.getBuffer(JimpMime.png);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Switching from getBufferAsync to getBuffer may introduce callback-based async handling.

getBuffer uses a callback and cannot be awaited directly. Please ensure it is promisified or use an async alternative to prevent issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minarkap , please review this comment to ensure we don’t introduce new bugs into the codebase.


const fileStream = new Readable();
fileStream._read = () => {}; // _read is required but you can noop it
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"outDir": "./dist",
"noEmitOnError": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"skipLibCheck": true,
Expand All @@ -34,4 +35,4 @@
"src/**/*",
"src/**/*.json"
]
}
}