Index: go-file.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/utils/go-file.c,v
retrieving revision 1.19
diff -p -u -b -r1.19 go-file.c
--- go-file.c	12 Dec 2004 21:34:57 -0000	1.19
+++ go-file.c	16 Dec 2004 18:17:51 -0000
@@ -177,9 +177,8 @@ go_dirname_from_uri (const char *uri, gb
 	g_free (raw_uri);
 #else
 	char *uri_dirname = g_path_get_dirname (uri);
-	char *dir = uri_dirname ? go_filename_from_uri (uri_dirname) : NULL;
+	dirname = uri_dirname ? go_filename_from_uri (uri_dirname) : NULL;
 	dirname = dirname ? g_strconcat ("file://", dirname, NULL) : NULL;
-	g_free (dir);
 	g_free (uri_dirname);
 #endif
 
@@ -426,10 +425,30 @@ go_url_show (gchar const *url)
 	if (browser == NULL &&
 	    RegOpenKeyEx (HKEY_CLASSES_ROOT, "http\\shell\\open\\command", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
 		if(RegQueryValueEx (hKey, NULL, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS) {
-			unsigned char *buf = g_new (unsigned char, dwSize + 1);
+			gchar *buf, *tmp, *progname, *shortname, *p, c;
+
+			buf = g_new (gchar, dwSize + 1);
 			RegQueryValueEx (hKey, NULL, NULL, &lType, buf, &dwSize);
-			browser = check_program (buf);
+			progname = tmp = g_strdup (buf);
+			if (tmp[0] == '"')
+			{
+				c = '"';
+				++progname;
+			}
+			else
+				c = ' ';
+			for (p = progname; p[0] && p[0] != c; ++p);
+            if (*p)
+                p[0] = '\0';
+            else
+                --p;
+			shortname = g_new (gchar, MAX_PATH);
+			GetShortPathName (progname, shortname, MAX_PATH);
+			if (check_program (shortname))
+				browser = g_strdup_printf ("\"%s\" %s", shortname, p + 1);
+			g_free (tmp);
 			g_free (buf);
+			g_free (shortname);
 		}
 		RegCloseKey(hKey);
 	}
@@ -482,8 +501,12 @@ go_url_show (gchar const *url)
 	if (browser != NULL) {
 		gint    argc;
 		gchar **argv = NULL;
-		char   *cmd_line = g_strconcat (browser, " %1", NULL);
+		char   *cmd_line;
 
+        if (!strstr (browser, " %1") && !strstr (browser, " \"%1\""))
+            cmd_line = g_strconcat (browser, " %1", NULL);
+        else
+            cmd_line = g_strdup (browser);
 		if (g_shell_parse_argv (cmd_line, &argc, &argv, &err)) {
 			/* check for '%1' in an argument and substitute the url
 			 * otherwise append it */
