X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=getdown%2Fsrc%2Fgetdown%2Fcore%2Fsrc%2Fmain%2Fjava%2Fcom%2Fthreerings%2Fgetdown%2Futil%2FHostWhitelist.java;h=f2f7ef39f1d1039aa1e0b6a18e07fb1eff5283d7;hb=dbfa10a0954d79fe8f0cde05dd23aa86efc3885b;hp=c05992abddb87273bde14aaf483ba9f3ef903576;hpb=f517e5ea31f1749617ac191137891cf87111550b;p=jalview.git diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/HostWhitelist.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/HostWhitelist.java index c05992a..f2f7ef3 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/HostWhitelist.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/HostWhitelist.java @@ -25,6 +25,8 @@ public final class HostWhitelist */ public static URL verify (URL url) throws MalformedURLException { + + return verify(Build.hostWhitelist(), url); } @@ -41,6 +43,12 @@ public final class HostWhitelist } String urlHost = url.getHost(); + String protocol = url.getProtocol(); + + if (ALLOW_LOCATOR_FILE_PROTOCOL && protocol.equals("file") && urlHost.equals("")) { + return url; + } + for (String host : hosts) { String regex = host.replace(".", "\\.").replace("*", ".*"); if (urlHost.matches(regex)) { @@ -51,4 +59,5 @@ public final class HostWhitelist throw new MalformedURLException( "The host for the specified URL (" + url + ") is not in the host whitelist: " + hosts); } + private static boolean ALLOW_LOCATOR_FILE_PROTOCOL = true; }