_notmuch_message_ensure_filename_list converts "relative" paths, such
as those stored in Xapian until now, to "absolute" paths. However,
URLs are already absolute, and prepending the database path will just
confuse matters.

Signed-off-by: Ethan Glasser-Camp <et...@betacantrips.com>
---
 lib/message.cc |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/message.cc b/lib/message.cc
index 978de06..c9857f5 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -700,9 +700,17 @@ _notmuch_message_ensure_filename_list (notmuch_message_t 
*message)
                                                          message->notmuch,
                                                          directory_id);
 
-       if (strlen (directory))
-           filename = talloc_asprintf (message, "%s/%s/%s",
-                                       db_path, directory, basename);
+       if (strlen (directory)) {
+           /* If directory is a URI, we don't need to append the db_path;
+            * it is already an absolute path. */
+           /* This is just a quick hack instead of actually parsing the URL. */
+           if (strstr (directory, "://") == NULL)
+               filename = talloc_asprintf (message, "%s/%s/%s",
+                                           db_path, directory, basename);
+           else
+               filename = talloc_asprintf (message, "%s/%s",
+                                           directory, basename);
+       }
        else
            filename = talloc_asprintf (message, "%s/%s",
                                        db_path, basename);
-- 
1.7.9.5

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to