fix: prevent sharp toFormat settings fallthrough by using clone (#2547)
This commit is contained in:
@@ -56,7 +56,7 @@ export default async function resizeAndSave({
|
||||
const sizesToSave: FileToSave[] = [];
|
||||
const sizeData = {};
|
||||
|
||||
const sharpInstance = sharp(file.tempFilePath || file.data);
|
||||
const sharpBase = sharp(file.tempFilePath || file.data);
|
||||
|
||||
const promises = imageSizes
|
||||
.map(async (desiredSize) => {
|
||||
@@ -71,7 +71,7 @@ export default async function resizeAndSave({
|
||||
};
|
||||
return;
|
||||
}
|
||||
let resized = sharpInstance.resize(desiredSize);
|
||||
let resized = sharpBase.clone().resize(desiredSize);
|
||||
|
||||
if (desiredSize.formatOptions) {
|
||||
resized = resized.toFormat(desiredSize.formatOptions.format, desiredSize.formatOptions.options);
|
||||
|
||||
Reference in New Issue
Block a user