fix: use file-type for mime sniffing

This commit is contained in:
Peter Steinberger
2025-12-20 19:13:50 +01:00
parent 1356498ee1
commit 36c85a617a
14 changed files with 5291 additions and 91 deletions

View File

@@ -319,7 +319,7 @@ async function resolveMedia(
);
}
const data = Buffer.from(await res.arrayBuffer());
const mime = detectMime({
const mime = await detectMime({
buffer: data,
headerMime: res.headers.get("content-type"),
filePath: file.file_path,

View File

@@ -37,7 +37,7 @@ export async function downloadTelegramFile(
throw new Error(`Failed to download telegram file: HTTP ${res.status}`);
}
const array = Buffer.from(await res.arrayBuffer());
const mime = detectMime({
const mime = await detectMime({
buffer: array,
headerMime: res.headers.get("content-type"),
filePath: info.file_path,