From d3333cb1b255efc19d862320dbbb8134714eedae Mon Sep 17 00:00:00 2001 From: Jakub Ječmínek Date: Mon, 25 Aug 2025 19:41:51 +0200 Subject: nnmbox-read-mbox: fix Xref header parsing * lisp/gnus/nnmbox.el (nnmbox-read-mbox): Use the 'mail-fetch-field' function instead of a broken regexp which matched Date-like headers. (Bug#79167) --- lisp/gnus/nnmbox.el | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el index fb024bf9ef8..f8575445b65 100644 --- a/lisp/gnus/nnmbox.el +++ b/lisp/gnus/nnmbox.el @@ -683,19 +683,24 @@ ;; headers). In this case, there is an Xref line which ;; provides the relevant information to construct the ;; missing header(s). - (save-excursion - (save-restriction - (narrow-to-region start end) - (if (re-search-forward "\nXref: [^ ]+" end-header t) - ;; generate headers from Xref: - (let (alist) - (while (re-search-forward " \\([^:]+\\):\\([0-9]+\\)" end-header t) - (push (cons (match-string 1) - (string-to-number (match-string 2))) alist)) - (nnmbox-insert-newsgroup-line alist)) - ;; this is really a new article - (nnmbox-save-mail - (nnmail-article-group 'nnmbox-active-number)))))) + (save-excursion + (save-restriction + (narrow-to-region start end) + (let ((xref (with-restriction start end-header + (mail-fetch-field "Xref"))) + alist) + (if (null xref) + ;; this is a new article + (nnmbox-save-mail + (nnmail-article-group 'nnmbox-active-number)) + ;; generate headers from Xref + ;; the first element is hostname so we skip it + (dolist (xref-entry (cdr (split-string xref " "))) + (push (cons + (car (setq xref-entry (split-string xref-entry ":"))) + (string-to-number (cadr xref-entry))) + alist)) + (nnmbox-insert-newsgroup-line alist)))))) (goto-char end)) ;; put article lists in order (setq alist nnmbox-group-active-articles) -- cgit v1.2.1