diff options
| author | Lars Ingebrigtsen | 2018-04-13 19:28:17 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-13 19:28:17 +0200 |
| commit | de28ae70effd64755e7543fd2cef90f8de5d8019 (patch) | |
| tree | b0ed34957213e2c8f6fa450108035cdb2fa1988d | |
| parent | 9f8c433d96011ed6d6120c614774ad2ce65bcc37 (diff) | |
| download | emacs-de28ae70effd64755e7543fd2cef90f8de5d8019.tar.gz emacs-de28ae70effd64755e7543fd2cef90f8de5d8019.zip | |
Make nnimap parse pathological spam headers better
* lisp/gnus/nnimap.el (nnimap-transform-headers): Unfold certain
pathological IMAP headers more correctly (bug#25502). Perhaps
this function should be re-implemented.
| -rw-r--r-- | lisp/gnus/nnimap.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 0d85a29ff2f..dc51b5f0f0c 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -220,15 +220,16 @@ textual parts.") | |||
| 220 | (cl-return))) | 220 | (cl-return))) |
| 221 | (goto-char (match-end 0)) | 221 | (goto-char (match-end 0)) |
| 222 | ;; Unfold quoted {number} strings. | 222 | ;; Unfold quoted {number} strings. |
| 223 | (while (re-search-forward | 223 | (while (or (looking-at "[ (]{\\([0-9]+\\)}\r?\n") |
| 224 | "[^]][ (]{\\([0-9]+\\)}\r?\n" | 224 | (re-search-forward |
| 225 | (save-excursion | 225 | "[^]][ (]{\\([0-9]+\\)}\r?\n" |
| 226 | ;; Start of the header section. | 226 | (save-excursion |
| 227 | (or (re-search-forward "] {[0-9]+}\r?\n" nil t) | 227 | ;; Start of the header section. |
| 228 | ;; Start of the next FETCH. | 228 | (or (re-search-forward "] {[0-9]+}\r?\n" nil t) |
| 229 | (re-search-forward "\\* [0-9]+ FETCH" nil t) | 229 | ;; Start of the next FETCH. |
| 230 | (point-max))) | 230 | (re-search-forward "\\* [0-9]+ FETCH" nil t) |
| 231 | t) | 231 | (point-max))) |
| 232 | t)) | ||
| 232 | (setq size (string-to-number (match-string 1))) | 233 | (setq size (string-to-number (match-string 1))) |
| 233 | (delete-region (+ (match-beginning 0) 2) (point)) | 234 | (delete-region (+ (match-beginning 0) 2) (point)) |
| 234 | (setq string (buffer-substring (point) (+ (point) size))) | 235 | (setq string (buffer-substring (point) (+ (point) size))) |