tweak the syntax

This commit is contained in:
Jesse Boyd 2017-02-08 12:12:55 +11:00
parent a3b8f4c917
commit d5d5b47cdb
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -372,7 +372,15 @@ public class BrushCommands {
if (!file.exists()) {
if (!filename.equals("#clipboard") && filename.length() >= 7) {
try {
URL url = new URL("https://i.imgur.com/" + filenamePng);
URL url;
if (filename.startsWith("http")) {
url = new URL(filename);
if (!url.getHost().equals("i.imgur.com")) {
throw new FileNotFoundException(filename);
}
} else {
url = new URL("https://i.imgur.com/" + filenamePng);
}
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
stream = Channels.newInputStream(rbc);
System.out.println("Loaded " + url);