better dimensions check

This commit is contained in:
leca 2025-07-19 18:53:50 +03:00
parent 65530963d7
commit 11bf2e6807
2 changed files with 4 additions and 3 deletions

View File

@ -11,3 +11,4 @@ COPY . .
EXPOSE 3000
ENTRYPOINT ["node", "./src/index.js"]

View File

@ -1,5 +1,3 @@
import bcrypt from 'bcrypt';
import jwt from 'jsonwebtoken';
import path from 'path';
@ -85,7 +83,9 @@ class UserController {
}
const image = await Jimp.read(tempPath);
if (image.bitmap.width != 64 || image.bitmap.height != 64) {
const allowedWidths = [32, 64, 128];
const allowedHeights = [32, 64];
if (!allowedWidths.includes(image.bitmap.width) || !allowedHeights.includes(image.bitmap.height)) {
return res.status(400).send('This does not look like a minecraft skin.');
}
try {