mirror of
https://github.com/kuroppoi/entralinked.git
synced 2026-04-25 15:47:00 -05:00
Check if uploaded file is actually an image
This commit is contained in:
parent
6999f1f976
commit
6f1853fc50
|
|
@ -284,6 +284,12 @@ public class DashboardHandler implements HttpHandler {
|
|||
BufferedImage image = ImageIO.read(ctx.bodyInputStream());
|
||||
BufferedImage previewImage = null;
|
||||
|
||||
// Make sure file is a valid image
|
||||
if(image == null) {
|
||||
ctx.json(new DashboardStatusMessage("File is either not an image or uses an unsupported format.", true));
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure image has the correct dimensions
|
||||
if(image.getWidth() != 256 || image.getHeight() != 192) {
|
||||
ctx.json(new DashboardStatusMessage("Image must be 256 x 192 pixels.", true));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user