Due to inconveniences in the Uri class, we need to be more careful when quoting URI's and when constructing one Uri from the ToString() output from another. (If we could serialize Uri's in XML it would be much easier...) This fixes the problem where beagle can't index files with characters such as @ and " in their name. http://bugzilla.gnome.org/show_bug.cgi?id=167664 Index: BeagleClient/Hit.cs =================================================================== RCS file: /cvs/gnome/beagle/BeagleClient/Hit.cs,v retrieving revision 1.14 diff -u -b -B -r1.14 Hit.cs --- BeagleClient/Hit.cs 15 Jan 2005 05:35:00 -0000 1.14 +++ BeagleClient/Hit.cs 17 Feb 2005 16:08:07 -0000 @@ -116,7 +116,7 @@ hit.Timestamp = BU.StringFu.StringToDateTime (reader.ReadString ()); hit.id = reader.ReadInt32 (); - hit.uri = new Uri (reader.ReadString ()); + hit.uri = BU.UriFu.UriStringToUri (reader.ReadString ()); hit.type = reader.ReadString (); hit.mimeType = reader.ReadString (); if (hit.mimeType == "") Index: BeagleClient/Indexable.cs =================================================================== RCS file: /cvs/gnome/beagle/BeagleClient/Indexable.cs,v retrieving revision 1.18 diff -u -b -B -r1.18 Indexable.cs --- BeagleClient/Indexable.cs 15 Feb 2005 00:39:36 -0000 1.18 +++ BeagleClient/Indexable.cs 17 Feb 2005 16:08:07 -0000 @@ -111,7 +111,7 @@ [XmlAttribute ("Uri")] public string UriString { get { return uri.ToString (); } - set { uri = new Uri (value); } + set { uri = BU.UriFu.UriStringToUri (value); } } [XmlIgnore] @@ -123,7 +123,7 @@ [XmlAttribute ("ContentUri")] public string ContentUriString { get { return ContentUri.ToString (); } - set { contentUri = new Uri (value); } + set { contentUri = BU.UriFu.UriStringToUri (value); } } [XmlIgnore] Index: Util/UriFu.cs =================================================================== RCS file: /cvs/gnome/beagle/Util/UriFu.cs,v retrieving revision 1.3 diff -u -b -B -r1.3 UriFu.cs --- Util/UriFu.cs 11 Feb 2005 20:58:25 -0000 1.3 +++ Util/UriFu.cs 17 Feb 2005 16:08:07 -0000 @@ -40,6 +40,22 @@ return new Uri (uriStr, true); } + static public Uri UriStringToUri (string path) + { + // Paths from the file:// indexer need (re)quoting. For example, + // valid characters such as @ need to be converted to their hex + // values. + if (path.StartsWith ("file://")) { + // Remove the file:// prefix + path = path.Substring (7); + + return PathToFileUri (path); + } + + // Currently, no other protocols need extra processing + return new Uri (path, true); + } + ////////////////////////////////// public class Comparer : IComparer Index: beagled/LuceneDriver.cs =================================================================== RCS file: /cvs/gnome/beagle/beagled/LuceneDriver.cs,v retrieving revision 1.57 diff -u -b -B -r1.57 LuceneDriver.cs --- beagled/LuceneDriver.cs 11 Feb 2005 20:58:25 -0000 1.57 +++ beagled/LuceneDriver.cs 17 Feb 2005 16:08:07 -0000 @@ -795,7 +795,7 @@ string uri = doc.Get ("Uri"); if (uri == null) throw new Exception ("Got document from Lucene w/o a URI!"); - return new Uri (uri, true); + return UriFu.UriStringToUri (uri); } static private void FromLuceneDocToVersioned (Document doc, Versioned versioned) Index: beagled/QueryImpl.cs =================================================================== RCS file: /cvs/gnome/beagle/beagled/QueryImpl.cs,v retrieving revision 1.31 diff -u -b -B -r1.31 QueryImpl.cs --- beagled/QueryImpl.cs 16 Feb 2005 18:49:04 -0000 1.31 +++ beagled/QueryImpl.cs 17 Feb 2005 16:08:07 -0000 @@ -170,7 +170,7 @@ { string snippet; - Uri uri = new Uri (uri_string, false); + Uri uri = UriFu.UriStringToUri (uri_string); Hit hit = result.GetHitFromUri (uri); if (hit == null) {