make contentDisposition optional
This commit is contained in:
@@ -87,12 +87,18 @@ export async function completeMultiPartUpload(
|
||||
await client.send(command);
|
||||
}
|
||||
|
||||
export async function getFileUrlS3(key: string, name: string | null) {
|
||||
export async function getFileUrlS3(
|
||||
key: string,
|
||||
name: string | null,
|
||||
contentDisposition: boolean
|
||||
) {
|
||||
const command = new GetObjectCommand({
|
||||
Bucket: BUCKET,
|
||||
Key: key,
|
||||
ResponseContentDisposition:
|
||||
name !== null ? `attachment; filename=${name}` : undefined,
|
||||
contentDisposition && name !== null
|
||||
? `attachment; filename=${name}`
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return await getSignedUrl(client, command, { expiresIn: 300 });
|
||||
|
||||
Reference in New Issue
Block a user