SPARK-1182: File path for a URL bookmark is not working

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12036 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Konstantin Zolotarev
2011-02-26 06:16:31 +00:00
committed by konstantin.zolotarev
parent 6c93069ac1
commit 7480029f4c

View File

@ -25,11 +25,14 @@ import java.net.URI;
public class BrowserLauncher {
public static void openURL(String url) throws Exception {
if (url.startsWith("http") ||
url.startsWith("ftp")) {
Desktop.getDesktop().browse(new URI(url));
if (url.startsWith("http") || url.startsWith("ftp") || url.startsWith("file")) {
if (url.startsWith("file") && url.contains(" ")) {
url = url.replace(" ", "%20");
}
else {
Desktop.getDesktop().browse(new URI(url));
} else {
Desktop.getDesktop().browse(new URI("http://" + url));
}
}