patch for displaying URIs



Hi,

I noticed that gnome_vfs_format_uri_for_display() wasn't unescaping URIs
that weren't local paths.  The attached patch fixes it, but I'm not
positive that it's correct....

Thanks,
James
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.1462
diff -u -r1.1462 ChangeLog
--- ChangeLog	22 Jan 2003 13:05:29 -0000	1.1462
+++ ChangeLog	28 Jan 2003 21:21:32 -0000
@@ -1,3 +1,10 @@
+2003-01-28  James Willcox  <jwillcox gnome org>
+
+	* libgnomevfs/gnome-vfs-utils.c:
+	(gnome_vfs_format_uri_for_display_internal):
+
+	Actually unescape the URI.
+
 2003-01-22  Pablo Saratxaga  <pablo mandrakesoft com>
 
 	* configure.in: Added Amharic (am), Bosnian (bs),
Index: libgnomevfs/gnome-vfs-utils.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-utils.c,v
retrieving revision 1.61
diff -u -r1.61 gnome-vfs-utils.c
--- libgnomevfs/gnome-vfs-utils.c	19 Dec 2002 17:57:19 -0000	1.61
+++ libgnomevfs/gnome-vfs-utils.c	28 Jan 2003 21:21:32 -0000
@@ -1115,7 +1115,7 @@
 static char *
 gnome_vfs_format_uri_for_display_internal (const char *uri, gboolean filenames_are_locale_encoded)
 {
-	char *canonical_uri, *path, *utf8_path;
+	char *canonical_uri, *path, *utf8_path, *unescaped_uri;
 
 	g_return_val_if_fail (uri != NULL, g_strdup (""));
 
@@ -1137,15 +1137,18 @@
 			return path;
 		}
 	}
+		
+	unescaped_uri = gnome_vfs_unescape_string (canonical_uri, G_DIR_SEPARATOR_S);
+	g_free (canonical_uri);
 
-	if (canonical_uri && !g_utf8_validate (canonical_uri, -1, NULL)) {
-		utf8_path = gnome_vfs_make_valid_utf8 (canonical_uri);
-		g_free (canonical_uri);
-		canonical_uri = utf8_path;
+	if (unescaped_uri && !g_utf8_validate (unescaped_uri, -1, NULL)) {
+		utf8_path = gnome_vfs_make_valid_utf8 (unescaped_uri);
+		g_free (unescaped_uri);
+		unescaped_uri = utf8_path;
 	}
 
 	g_free (path);
-	return canonical_uri;
+	return unescaped_uri;
 }
 
 


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