Index: libgnomevfs/gnome-vfs-uri.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.c,v
retrieving revision 1.135
diff -u -p -r1.135 gnome-vfs-uri.c
--- libgnomevfs/gnome-vfs-uri.c	9 Jun 2006 11:22:43 -0000	1.135
+++ libgnomevfs/gnome-vfs-uri.c	15 Jul 2006 17:00:41 -0000
@@ -897,13 +897,30 @@ make_full_uri_from_relative (const char 
  * @relative_reference: a string representing a possibly relative uri reference.
  * 
  * Create a new uri from @relative_reference, relative to @base. The resolution
- * algorithm follows RFC 2396. For details, see section 5.2 of
- * http://www.ietf.org/rfc/rfc2396.txt .
+ * algorithm in some aspects follows <ulink url="http://www.ietf.org/rfc/rfc2396.txt">RFC
+ * 2396</ulink>, section 5.2, but is not identical due to some extra assumptions GnomeVFS
+ * makes about URIs.
  *
- * In short, if the @base uri ends in '/', @relative_reference is appended to @base,
- * otherwise it replaces the part of @base after the last '/'.
+ * If @relative_reference begins with a valid scheme identifier followed by ':',
+ * it is assumed to refer to an absolute URI, and a #GnomeVFSURI is created from
+ * it using gnome_vfs_uri_new(). 
  *
- * Return value: The new uri.
+ * Otherwise, depending on its precise syntax, it inherits some aspects of the parent URI,
+ * but the parents' fragment and query components are ignored.
+ *
+ * If @relative_reference begins with "//", it only inherits the @base scheme,
+ * if it begins with '/' (i.e. is an absolute path reference), it inherits everything
+ * ecxept the @base path. Otherwise, it replaces the part of @base after the last '/'.
+ *
+ * <note>
+ *  This function should not be used by application authors unless they expect very
+ *  distinct semantics. Instead, authors should use gnome_vfs_uri_append_file_name(),
+ *  gnome_vfs_uri_append_path(), gnome_vfs_uri_append_string() or
+ *  gnome_vfs_uri_resolve_symbolic_link().
+ * </note>
+ *
+ * Return value: A #GnomeVFSURI referring to @relative_reference, or %NULL
+ * if @relative_reference was malformed.
  */
 GnomeVFSURI *
 gnome_vfs_uri_resolve_relative (const GnomeVFSURI *base,
@@ -932,6 +949,34 @@ gnome_vfs_uri_resolve_relative (const Gn
 
 	g_free (text_base);
 	g_free (text_new);
+
+	return uri;
+}
+
+/**
+ * gnome_vfs_uri_resolve_symbolic_link:
+ * @base: base uri.
+ * @symbolic_link: a string representing a possibly relative or absolute path reference.
+ * 
+ * Create a new uri from @symbolic_link, relative to @base.
+ *
+ * If @symbolic_link begins with a '/', it replaces the path of @base,
+ * otherwise it is appended after the last '/' character of @base.
+ *
+ * Return value: A new #GnomeVFSURI referring to @symbolic_link.
+ */
+GnomeVFSURI *
+gnome_vfs_uri_resolve_symbolic_link (const GnomeVFSURI *base,
+				     const gchar *symbolic_link)
+{
+	GnomeVFSURI *uri;
+
+	g_return_val_if_fail (base != NULL, NULL);
+	g_return_val_if_fail (symbolic_link != NULL, NULL);
+
+	uri = gnome_vfs_uri_dup (base);
+	g_free (uri->text);
+	uri->text = gnome_vfs_resolve_symlink (gnome_vfs_uri_get_path (uri), symbolic_link);
 
 	return uri;
 }
Index: libgnomevfs/gnome-vfs-uri.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.h,v
retrieving revision 1.35
diff -u -p -r1.35 gnome-vfs-uri.h
--- libgnomevfs/gnome-vfs-uri.h	22 Jun 2006 12:10:36 -0000	1.35
+++ libgnomevfs/gnome-vfs-uri.h	15 Jul 2006 17:00:42 -0000
@@ -155,6 +155,8 @@ GType gnome_vfs_uri_hide_options_get_typ
 GnomeVFSURI 	     *gnome_vfs_uri_new                   (const gchar *text_uri);
 GnomeVFSURI 	     *gnome_vfs_uri_resolve_relative      (const GnomeVFSURI *base,
 							   const gchar *relative_reference);
+GnomeVFSURI 	     *gnome_vfs_uri_resolve_symbolic_link (const GnomeVFSURI *base,
+							   const gchar *relative_reference);
 GnomeVFSURI 	     *gnome_vfs_uri_ref                   (GnomeVFSURI *uri);
 void        	      gnome_vfs_uri_unref                 (GnomeVFSURI *uri);
 
Index: libgnomevfs/gnome-vfs-utils.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-utils.c,v
retrieving revision 1.115
diff -u -p -r1.115 gnome-vfs-utils.c
--- libgnomevfs/gnome-vfs-utils.c	14 Jul 2006 07:35:40 -0000	1.115
+++ libgnomevfs/gnome-vfs-utils.c	15 Jul 2006 17:00:46 -0000
@@ -1983,17 +1983,8 @@ _gnome_vfs_uri_resolve_all_symlinks_uri 
 				goto out;
 			}
 			escaped_symlink = gnome_vfs_escape_path_string (info->symlink_name);
-			resolved_uri = gnome_vfs_uri_resolve_relative (new_uri,
-								       escaped_symlink);
-			g_free (escaped_symlink);
-			if (resolved_uri == NULL) {
-				gnome_vfs_uri_unref (new_uri);
-				/* FIXME this shouldn't happen. gnome_vfs_uri_resolve_relative
-				 * treats some relative URIs as absolute if they contain special
-				 * characters. We should escape them, or the relative URI recognition
-				 * should be improved */
-				break;
-			}
+			resolved_uri = gnome_vfs_uri_resolve_symbolic_link (new_uri, escaped_symlink);
+			g_assert (resolved_uri != NULL);
 
 			if (*p != 0) {
 				gnome_vfs_uri_unref (new_uri);
Index: doc/gnome-vfs-2.0-sections.txt
===================================================================
RCS file: /cvs/gnome/gnome-vfs/doc/gnome-vfs-2.0-sections.txt,v
retrieving revision 1.11
diff -u -p -r1.11 gnome-vfs-2.0-sections.txt
--- doc/gnome-vfs-2.0-sections.txt	22 Jun 2006 12:10:35 -0000	1.11
+++ doc/gnome-vfs-2.0-sections.txt	15 Jul 2006 17:00:46 -0000
@@ -267,6 +267,7 @@ GNOME_VFS_URI_PATH_CHR
 GNOME_VFS_URI_PATH_STR
 gnome_vfs_uri_new
 gnome_vfs_uri_resolve_relative
+gnome_vfs_uri_resolve_symbolic_link
 gnome_vfs_uri_ref
 gnome_vfs_uri_unref
 gnome_vfs_uri_append_string
