[RFC PATCH 04/14] Not all filenames need to be converted to absolute paths
Ethan Glasser-Camp
ethan.glasser.camp at gmail.com
Mon Jun 25 13:41:29 PDT 2012
_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 <ethan at 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
More information about the notmuch
mailing list