From bb7e7584d49a27ed549820333e4729c921ef5c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 29 Jan 2026 21:11:51 +0000 Subject: [PATCH] Include `Content-Disposition: attachment` on some uploaded assets (#197) --- entry | 5 +++-- mcp/upload.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/entry b/entry index c2af0f9..4b29e1d 100755 --- a/entry +++ b/entry @@ -143108,13 +143108,14 @@ function UploadFileTool(ctx) { const error50 = await response.text(); throw new Error(`failed to get upload URL: ${error50}`); } - const { uploadUrl, publicUrl } = await response.json(); + const { uploadUrl, publicUrl, contentDisposition } = await response.json(); const uploadResponse = await fetch(uploadUrl, { method: "PUT", headers: { "Content-Type": contentType, // should be set automatically, but given this header is signed it's better to be explicit - "Content-Length": String(contentLength) + "Content-Length": String(contentLength), + ...contentDisposition && { "Content-Disposition": contentDisposition } }, body: buffer }); diff --git a/mcp/upload.ts b/mcp/upload.ts index 29638e9..050e261 100644 --- a/mcp/upload.ts +++ b/mcp/upload.ts @@ -44,9 +44,10 @@ export function UploadFileTool(ctx: ToolContext) { throw new Error(`failed to get upload URL: ${error}`); } - const { uploadUrl, publicUrl } = (await response.json()) as { + const { uploadUrl, publicUrl, contentDisposition } = (await response.json()) as { uploadUrl: string; publicUrl: string; + contentDisposition?: string | undefined; }; const uploadResponse = await fetch(uploadUrl, { @@ -55,6 +56,7 @@ export function UploadFileTool(ctx: ToolContext) { "Content-Type": contentType, // should be set automatically, but given this header is signed it's better to be explicit "Content-Length": String(contentLength), + ...(contentDisposition && { "Content-Disposition": contentDisposition }), }, body: buffer, });