Include Content-Disposition: attachment on some uploaded assets (#197)
This commit is contained in:
committed by
pullfrog[bot]
parent
943409c417
commit
bb7e7584d4
@@ -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
|
||||
});
|
||||
|
||||
+3
-1
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user