From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id qGUtKUDNqmBvLAAAsNZ9tg (envelope-from ); Sun, 23 May 2021 21:46:40 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qGlRFTzNqmDwawAAB5/wlQ (envelope-from ); Sun, 23 May 2021 21:46:36 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1621806396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n8989HSLPE1ahUw1Y2hHf2ICufD79ISzYV73D92+6mE=; b=IGh8nYCVtQF+QefDdmJKr3nWw8Ig2KK2ET6zXAIOP7Kmt/a3K2nCArogJByXOUD2Sk1uan WDAdx8blp36lXLVjE2/wietIXo+WnYOaDqKSJls8rB8AngpTcfXEg/NyambtZ7lLm93qSj 2p+FaAzDRk+Ei5cj5Vo0Dat4SNeWh7OntgA/Jx+M6ZGHvMwK37SJXwMGQ9FmvxzVUR3z0D 46pXEOp+YtQlcnEtLUTD0ta2ZOWF+6fFmq/U1ct2jnkDy51sTIxaVnR34aYFY7XJI9qzb6 X9Cv+qKk/4+oyDHF5G3DMuTD1VxBgsCNYah7ZfJY735j9cpkPSvVV+CCHgZzyA== From: Kyle Meyer To: piem@inbox.kyleam.com Subject: [PATCH 1/5] b4: Check for message ID match when using current buffer's URL Date: Sun, 23 May 2021 17:46:19 -0400 Message-Id: <20210523214623.31331-2-kyle@kyleam.com> In-Reply-To: <20210523214623.31331-1-kyle@kyleam.com> References: <20210523214623.31331-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com X-TUID: wypKdy4VeuvC If piem-mid-to-thread-functions fails to generate the thread, piem-b4--get-am-files tries to download the mbox from the URL associated with the current buffer. However, it uses the message ID returned by piem-mid rather than the message ID passed by piem-b4-am-from-mid. That's not a safe assumption for non-interactive calls to piem-b4-am-from-mid. Construct the URL with the message ID passed by piem-b4-am-from-mid, and skip the download completely if that message ID doesn't match the one for the current buffer. --- piem-b4.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/piem-b4.el b/piem-b4.el index f25a676..48c8bf4 100644 --- a/piem-b4.el +++ b/piem-b4.el @@ -72,8 +72,8 @@ (defun piem-b4--get-am-files (mid coderepo args) ;; try to download it from a URL at `piem-inboxes'. Finally, fall ;; back to b4's configuration. (unless local-mbox-p - (when-let ((url (piem-inbox-get :url)) - (mid (piem-mid)) + (when-let ((url (and (equal mid (piem-mid)) + (piem-inbox-get :url))) (buffer (condition-case nil (piem-download-and-decompress (concat url (piem-escape-mid mid) "/t.mbox.gz")) -- 2.31.1