diff options
| author | Jakub Ječmínek | 2025-08-25 19:41:51 +0200 |
|---|---|---|
| committer | Robert Pluim | 2025-09-26 16:03:11 +0200 |
| commit | d3333cb1b255efc19d862320dbbb8134714eedae (patch) | |
| tree | 0cfd4fc144251d5bbb50b8e9c171adb9930a1540 | |
| parent | bf750adc4e637d871d551bab5b5c6ff9240797ed (diff) | |
| download | emacs-d3333cb1b255efc19d862320dbbb8134714eedae.tar.gz emacs-d3333cb1b255efc19d862320dbbb8134714eedae.zip | |
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)
| -rw-r--r-- | lisp/gnus/nnmbox.el | 31 |
1 files 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 @@ | |||
| 683 | ;; headers). In this case, there is an Xref line which | 683 | ;; headers). In this case, there is an Xref line which |
| 684 | ;; provides the relevant information to construct the | 684 | ;; provides the relevant information to construct the |
| 685 | ;; missing header(s). | 685 | ;; missing header(s). |
| 686 | (save-excursion | 686 | (save-excursion |
| 687 | (save-restriction | 687 | (save-restriction |
| 688 | (narrow-to-region start end) | 688 | (narrow-to-region start end) |
| 689 | (if (re-search-forward "\nXref: [^ ]+" end-header t) | 689 | (let ((xref (with-restriction start end-header |
| 690 | ;; generate headers from Xref: | 690 | (mail-fetch-field "Xref"))) |
| 691 | (let (alist) | 691 | alist) |
| 692 | (while (re-search-forward " \\([^:]+\\):\\([0-9]+\\)" end-header t) | 692 | (if (null xref) |
| 693 | (push (cons (match-string 1) | 693 | ;; this is a new article |
| 694 | (string-to-number (match-string 2))) alist)) | 694 | (nnmbox-save-mail |
| 695 | (nnmbox-insert-newsgroup-line alist)) | 695 | (nnmail-article-group 'nnmbox-active-number)) |
| 696 | ;; this is really a new article | 696 | ;; generate headers from Xref |
| 697 | (nnmbox-save-mail | 697 | ;; the first element is hostname so we skip it |
| 698 | (nnmail-article-group 'nnmbox-active-number)))))) | 698 | (dolist (xref-entry (cdr (split-string xref " "))) |
| 699 | (push (cons | ||
| 700 | (car (setq xref-entry (split-string xref-entry ":"))) | ||
| 701 | (string-to-number (cadr xref-entry))) | ||
| 702 | alist)) | ||
| 703 | (nnmbox-insert-newsgroup-line alist)))))) | ||
| 699 | (goto-char end)) | 704 | (goto-char end)) |
| 700 | ;; put article lists in order | 705 | ;; put article lists in order |
| 701 | (setq alist nnmbox-group-active-articles) | 706 | (setq alist nnmbox-group-active-articles) |