better dimensions check
This commit is contained in:
parent
65530963d7
commit
11bf2e6807
|
@ -11,3 +11,4 @@ COPY . .
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["node", "./src/index.js"]
|
ENTRYPOINT ["node", "./src/index.js"]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
import bcrypt from 'bcrypt';
|
import bcrypt from 'bcrypt';
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
@ -85,7 +83,9 @@ class UserController {
|
||||||
}
|
}
|
||||||
|
|
||||||
const image = await Jimp.read(tempPath);
|
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.');
|
return res.status(400).send('This does not look like a minecraft skin.');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue