Fix file handle leak on empty chat info

be54ef3dacfc6706992b2ec0d5fbc9ee5ef49d85

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +1 -1Ignore whitespace
src/endpoints/chats.js+1 -1
@@ -368,7 +368,6 @@ async function checkChatIntegrity(filePath, integritySlug) {
368368 */
369369export async function getChatInfo(pathToFile, additionalData = {}, isGroup = false) {
370370 return new Promise(async (res) => {
371- const fileStream = fs.createReadStream(pathToFile);
372371 const stats = await fs.promises.stat(pathToFile);
373372 const fileSizeInKB = `${(stats.size / 1024).toFixed(2)}kb`;
374373
@@ -392,6 +391,7 @@ export async function getChatInfo(pathToFile, additionalData = {}, isGroup = fal
392391 return;
393392 }
394393
394+ const fileStream = fs.createReadStream(pathToFile);
395395 const rl = readline.createInterface({
396396 input: fileStream,
397397 crlfDelay: Infinity,