Skip to content
Open
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
6 changes: 5 additions & 1 deletion src/messaging/inbound/media-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export async function downloadResources(params: {
contentType = await core.media.detectMime({ buffer: result.buffer });
}

const fileName = result.fileName || res.fileName;
// Prefer the file name from the message body (res.fileName) over
// Content-Disposition (result.fileName), because Feishu may return
// raw UTF-8 bytes in the header that get misinterpreted as Latin1
// by Node.js HTTP clients, producing garbled non-ASCII filenames.
const fileName = res.fileName || result.fileName;
const saved = await core.channel.media.saveMediaBuffer(result.buffer, contentType, 'inbound', maxBytes, fileName);

const placeholder = inferPlaceholderFromType(res.type);
Expand Down