From 3fcaf7fd41d5b2b17bc8127562c7d68bed03159d Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Fri, 19 May 2023 18:16:59 +0300 Subject: [PATCH] Check for user avatar crop --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index c90aa86c3..66c3291c2 100644 --- a/server.js +++ b/server.js @@ -915,7 +915,7 @@ async function tryReadImage(img_url, crop) { } async function charaRead(img_url, input_format) { - return characterCardParser.parse(img_url, input_format); + return characterCardParser.parse(img_url, input_format); } app.post("/getcharacters", jsonParser, function (request, response) { @@ -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); }