mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
Close #859 - more favicon validation
This commit is contained in:
parent
5adc0000d8
commit
ddab9a84c4
@ -68,19 +68,25 @@ public class Configuration implements ProxyConfig
|
||||
try
|
||||
{
|
||||
BufferedImage image = ImageIO.read( fav );
|
||||
if ( image.getHeight() == 64 && image.getWidth() == 64 )
|
||||
if ( image != null )
|
||||
{
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
ImageIO.write( image, "png", bytes );
|
||||
favicon = "data:image/png;base64," + BaseEncoding.base64().encode( bytes.toByteArray() );
|
||||
if ( favicon.length() > Short.MAX_VALUE )
|
||||
if ( image.getHeight() == 64 && image.getWidth() == 64 )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Favicon file too large for server to process" );
|
||||
favicon = null;
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
ImageIO.write( image, "png", bytes );
|
||||
favicon = "data:image/png;base64," + BaseEncoding.base64().encode( bytes.toByteArray() );
|
||||
if ( favicon.length() > Short.MAX_VALUE )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Favicon file too large for server to process" );
|
||||
favicon = null;
|
||||
}
|
||||
} else
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Server icon must be exactly 64x64 pixels" );
|
||||
}
|
||||
} else
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Server icon must be exactly 64x64 pixels" );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not load server icon for unknown reason. Please double check its format." );
|
||||
}
|
||||
} catch ( IOException ex )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user