better dimensions check
This commit is contained in:
@@ -11,3 +11,4 @@ COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["node", "./src/index.js"]
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user