Check for user avatar crop

This commit is contained in:
SillyLossy
2023-05-19 18:16:59 +03:00
parent ee7c4ee78f
commit 3fcaf7fd41

View File

@ -1873,7 +1873,7 @@ app.post('/uploaduseravatar', urlencodedParser, async (request, response) => {
const crop = tryParse(request.query.crop);
let rawImg = await jimp.read(pathToUpload);
if (typeof crop == 'object') {
if (typeof crop == 'object' && [crop.x, crop.y, crop.width, crop.height].every(x => typeof x === 'number')) {
rawImg = rawImg.crop(crop.x, crop.y, crop.width, crop.height);
}