1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

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)
This commit is contained in:
Jakub Ječmínek 2025-08-25 19:41:51 +02:00 committed by Robert Pluim
parent bf750adc4e
commit d3333cb1b2

View file

@ -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)