[Nautilus-list] Possible patch for bug #73368



Hi,

bug #73368 says that opening an image with a '!' character in the filename
doesn't work with Eye of Gnome. Well, it seems to me that this is more a
general nautilus bug, because it uses such an URI directly as vfs:
moniker, when trying to obtain a BonoboStream object for it:

moniker_str = g_strconcat ("vfs:", uri, NULL);
stream = bonobo_get_object (moniker_str, "IDL:Bonobo/Stream:1.0",
                            &ev);

Since '!' is used as delimiter for moniker attributes this isn't going to
work.

Attached is a patch which fixes this. It's likely that I oversee a
situation in which this patch may raise other problems, but I think it is
safe.

Regards,

    Jens

-- 
"Wer die Freiheit aufgibt, um Sicherheit zu gewinnen, wird am Ende beides
verlieren." -- Benjamin Franklin

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5089
diff -u -p -B -r1.5089 ChangeLog
--- ChangeLog	2002/03/05 13:44:19	1.5089
+++ ChangeLog	2002/03/05 17:17:30
@@ -1,3 +1,9 @@
+2002-03-05  Jens Finke  <jens triq net>
+
+	* components/adapter/nautilus-adapter-stream-load-strategy.c
+	(nautilus_adapter_stream_load_strategy_load_location): Escape '!'
+	character in URIs before using it as a moniker string. 
+
 2002-03-05  Anders Carlsson  <andersca gnu org>
 
 	* libnautilus-private/nautilus-global-preferences.c 
Index: components/adapter/nautilus-adapter-stream-load-strategy.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/adapter/nautilus-adapter-stream-load-strategy.c,v
retrieving revision 1.16
diff -u -p -B -r1.16 nautilus-adapter-stream-load-strategy.c
--- components/adapter/nautilus-adapter-stream-load-strategy.c	2002/01/04 20:52:15	1.16
+++ components/adapter/nautilus-adapter-stream-load-strategy.c	2002/03/05 17:17:30
@@ -38,6 +38,7 @@
 #include <gtk/gtkobject.h>
 #include <eel/eel-gtk-macros.h>
 #include <libnautilus/nautilus-view.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
 
 struct NautilusAdapterStreamLoadStrategyDetails {
 	Bonobo_PersistStream  persist_stream;
@@ -122,6 +123,7 @@ nautilus_adapter_stream_load_strategy_lo
 	Bonobo_Stream stream;
 	CORBA_Environment ev;
 	char *moniker_str;
+	char *escaped_uri;
 
 	strategy = NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY (abstract_strategy);
 	g_object_ref (strategy);
@@ -129,10 +131,15 @@ nautilus_adapter_stream_load_strategy_lo
 	CORBA_exception_init (&ev);
 
 	nautilus_adapter_load_strategy_report_load_underway (abstract_strategy);
-	
-	moniker_str = g_strconcat ("vfs:", uri, NULL);
+
+	/* We must escape the '!' in the URI here, because it is
+	 * used as argument delimiter within monikers.
+	 */
+	escaped_uri = gnome_vfs_escape_set (uri, "!");
+	moniker_str = g_strconcat ("vfs:", escaped_uri, NULL);
 	stream = bonobo_get_object (moniker_str, "IDL:Bonobo/Stream:1.0", &ev);
 	g_free (moniker_str);
+	g_free (escaped_uri);
 
 	if (BONOBO_EX (&ev) || CORBA_Object_is_nil (stream, &ev)) {
 		nautilus_adapter_load_strategy_report_load_failed (abstract_strategy);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]