fix(feishu): extract contentType and fileName from download response headers
This commit is contained in:
parent
4c230418b9
commit
cc50033593
@ -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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user