From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 74D7D431FB6 for ; Mon, 25 Jun 2012 13:43:35 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.061 X-Spam-Level: * X-Spam-Status: No, score=1.061 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gaVyWTs22Yro for ; Mon, 25 Jun 2012 13:43:34 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id AD3FD431FAF for ; Mon, 25 Jun 2012 13:43:34 -0700 (PDT) Received: by mail-we0-f181.google.com with SMTP id j55so3641437wer.26 for ; Mon, 25 Jun 2012 13:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=2g6fkbspKufW8i3FIxqeJ+0mMu74Hdt3y8rYV9jx2YM=; b=NW7Q72PrWAc1OqxJppQQBwNdqdF85bfaMXDC1CuZVg9+vd3oxt1llqb0yfhzKzXxkD L4qjMyNkNednQ3cHuNnAJBl20qRf7sZCevupc4Sjq238MrHdLzRoXLIJrm/S7gkcYgK9 jaMAQJOWwU1aWq99/lj60H0RLvHIt90fUIhss1I6adyGJ+5mTB2CaYSy8sf5bDV8i2mh bFLMqTKAloX03n8aFLpj6VIWrHSrVmBuOISs+cUX7zRBl1Y6VqWlczmkknUgTtU8ccuj dJ/kkBb666aADB/mV/O6xhGEFcTCXyfOGcgp8RTnfjuegmajNf5APoDoFc+7pauppvIY JDuA== Received: by 10.216.212.1 with SMTP id x1mr7098348weo.143.1340657011561; Mon, 25 Jun 2012 13:43:31 -0700 (PDT) Received: from localhost ([195.24.209.21]) by mx.google.com with ESMTPS id ei4sm37314729wid.5.2012.06.25.13.43.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jun 2012 13:43:30 -0700 (PDT) From: Ethan Glasser-Camp To: notmuch@notmuchmail.org Subject: [RFC PATCH 04/14] Not all filenames need to be converted to absolute paths Date: Mon, 25 Jun 2012 16:41:29 -0400 Message-Id: <1340656899-5644-5-git-send-email-ethan@betacantrips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340656899-5644-1-git-send-email-ethan@betacantrips.com> References: <1340656899-5644-1-git-send-email-ethan@betacantrips.com> X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 20:43:35 -0000 _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 --- 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