fix: correct square image validation logic in resizeBase64Image (#25130)
The validation was comparing image height to itself instead of comparing height to width, causing the square check to always pass even for non-square images. Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com>
This commit is contained in:
co-authored by
Dhairyashil Shinde
parent
9e10dfd77b
commit
d6f6be7d50
@@ -26,7 +26,7 @@ export async function resizeBase64Image(
|
||||
maxSize = 96 * 4,
|
||||
} = opts ?? {};
|
||||
const image = await jimp.read(buffer);
|
||||
if (image.getHeight() !== image.getHeight()) {
|
||||
if (image.getHeight() !== image.getWidth()) {
|
||||
// this could be handled later
|
||||
throw new Error("Image is not a square");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user