IO-3340 Change application type on PDFs uploaded via imgproxy to allow inline display.
This commit is contained in:
@@ -44,11 +44,20 @@ const generateSignedUploadUrls = async (req, res) => {
|
||||
for (const filename of filenames) {
|
||||
const key = filename;
|
||||
const client = new S3Client({ region: InstanceRegion() });
|
||||
const command = new PutObjectCommand({
|
||||
|
||||
// Check if filename indicates PDF and set content type accordingly
|
||||
const isPdf = filename.toLowerCase().endsWith('.pdf');
|
||||
const commandParams = {
|
||||
Bucket: imgproxyDestinationBucket,
|
||||
Key: key,
|
||||
StorageClass: "INTELLIGENT_TIERING"
|
||||
});
|
||||
};
|
||||
|
||||
if (isPdf) {
|
||||
commandParams.ContentType = "application/pdf";
|
||||
}
|
||||
|
||||
const command = new PutObjectCommand(commandParams);
|
||||
const presignedUrl = await getSignedUrl(client, command, { expiresIn: 360 });
|
||||
signedUrls.push({ filename, presignedUrl, key });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user