diff --git a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java index 3ab271d75bc3..af1b5d9f1b3d 100644 --- a/platform/platform-api/src/com/intellij/ide/BrowserUtil.java +++ b/platform/platform-api/src/com/intellij/ide/BrowserUtil.java @@ -171,11 +171,11 @@ public class BrowserUtil { try { final GeneralCommandLine commandLine = new GeneralCommandLine(command); - commandLine.addParameter(curl.toString()); + commandLine.addParameter(escapeUrl(curl.toString())); commandLine.createProcess(); if (LOG.isDebugEnabled()) { - LOG.debug("Browser launched with command line: " + commandLine.getCommandLineString()); + LOG.debug("Browser launched with command line: " + commandLine); } } catch (final ExecutionException e) { @@ -185,12 +185,8 @@ public class BrowserUtil { @NotNull public static String escapeUrl(@NotNull @NonNls String url) { - if (SystemInfo.isWindows) { - return (url.indexOf(' ') > 0 || url.indexOf('&') > -1) ? "\"" + url + "\"" : url; - } - else { - return url.replaceAll(" ", "%20"); - } + return SystemInfo.isWindows ? url.replaceAll(" ", "%20") + : url; } private static boolean launchBrowserUsingDesktopApi(final String sUrl) { @@ -226,6 +222,7 @@ public class BrowserUtil { public static String[] getOpenBrowserCommand(final @NonNls @NotNull String browserPath) { final String[] command; + if (SystemInfo.isMac) { if (new File(browserPath).isFile()) { // versions before 10.6 don't allow to pass command line arguments to browser via 'open' command @@ -247,6 +244,7 @@ public class BrowserUtil { else { command = new String[]{browserPath}; } + return command; }