make contentDisposition optional

This commit is contained in:
2025-04-16 11:43:18 +05:30
parent 371a103601
commit 3b9cb59a05
2 changed files with 14 additions and 3 deletions

View File

@@ -153,6 +153,7 @@ export async function fileDownloadHandler(
res: FastifyReply
) {
const { fileId } = req.params as { fileId: string };
const { contentDisposition } = req.query as { contentDisposition: boolean };
try {
const file = await getFile(fileId, req.user.tenantId);
@@ -162,7 +163,11 @@ export async function fileDownloadHandler(
if (file.mimeType == "folder")
return res.code(400).send({ error: "cannot download a folder" });
const signedUrl = await getFileUrlS3(file.pid, file.name);
const signedUrl = await getFileUrlS3(
file.pid,
file.name,
contentDisposition
);
return res.code(200).send({ url: signedUrl });
} catch (err) {
return err;