mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 06:27:39 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -27,7 +27,9 @@ export async function downloadTelegramFile(
|
||||
info: TelegramFileInfo,
|
||||
maxBytes?: number,
|
||||
): Promise<SavedMedia> {
|
||||
if (!info.file_path) throw new Error("file_path missing");
|
||||
if (!info.file_path) {
|
||||
throw new Error("file_path missing");
|
||||
}
|
||||
const url = `https://api.telegram.org/file/bot${token}/${info.file_path}`;
|
||||
const res = await fetch(url);
|
||||
if (!res.ok || !res.body) {
|
||||
@@ -42,6 +44,8 @@ export async function downloadTelegramFile(
|
||||
// save with inbound subdir
|
||||
const saved = await saveMediaBuffer(array, mime, "inbound", maxBytes, info.file_path);
|
||||
// Ensure extension matches mime if possible
|
||||
if (!saved.contentType && mime) saved.contentType = mime;
|
||||
if (!saved.contentType && mime) {
|
||||
saved.contentType = mime;
|
||||
}
|
||||
return saved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user