IO-3340 Resolve unenforced content-type
This commit is contained in:
@@ -58,8 +58,20 @@ const generateSignedUploadUrls = async (req, res) => {
|
||||
}
|
||||
|
||||
const command = new PutObjectCommand(commandParams);
|
||||
const presignedUrl = await getSignedUrl(client, command, { expiresIn: 360 });
|
||||
signedUrls.push({ filename, presignedUrl, key });
|
||||
|
||||
// For PDFs, we need to add conditions to the presigned URL to enforce content type
|
||||
const presignedUrlOptions = { expiresIn: 360 };
|
||||
if (isPdf) {
|
||||
presignedUrlOptions.signableHeaders = new Set(['content-type']);
|
||||
}
|
||||
|
||||
const presignedUrl = await getSignedUrl(client, command, presignedUrlOptions);
|
||||
signedUrls.push({
|
||||
filename,
|
||||
presignedUrl,
|
||||
key,
|
||||
...(isPdf && { contentType: "application/pdf" })
|
||||
});
|
||||
}
|
||||
|
||||
logger.log("imgproxy-upload-success", "DEBUG", req.user?.email, jobid, { signedUrls });
|
||||
|
||||
Reference in New Issue
Block a user