fix(feishu): extract contentType and fileName from download response headers

This commit is contained in:
Tang QI 2026-03-19 22:03:26 +08:00
parent 4c230418b9
commit cc50033593

View File

@ -176,7 +176,19 @@ export async function downloadMessageResourceFeishu(params: {
tmpDirPrefix: "openclaw-feishu-resource-",
errorPrefix: "Feishu message resource download failed",
});
return { buffer };
// Extract metadata from response headers
const contentType = response.headers?.["content-type"] as string | undefined;
const contentDisposition = response.headers?.["content-disposition"] as string | undefined;
let extractedFileName: string | undefined;
if (contentDisposition) {
const match = contentDisposition.match(/filename="?([^"]+)"?/);
if (match) {
extractedFileName = match[1];
}
}
return { buffer, contentType, fileName: extractedFileName };
}
export type UploadImageResult = {