1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 18:41:25 -08:00

Make nndoc more resilient against corrupted files

* lisp/gnus/nndoc.el (nndoc-possibly-change-buffer): Don't bug
out on invalid files, like invalid .gz files (bug#21538).
This may hinder Gnus from starting up.
This commit is contained in:
Lars Ingebrigtsen 2017-01-26 22:28:17 +01:00
parent 3a9e56d840
commit 47e82854ba

View file

@ -356,14 +356,18 @@ from the document.")
(setq nndoc-dissection-alist nil) (setq nndoc-dissection-alist nil)
(with-current-buffer nndoc-current-buffer (with-current-buffer nndoc-current-buffer
(erase-buffer) (erase-buffer)
(if (and (stringp nndoc-address) (condition-case error
(string-match nndoc-binary-file-names nndoc-address)) (if (and (stringp nndoc-address)
(let ((coding-system-for-read 'binary)) (string-match nndoc-binary-file-names nndoc-address))
(mm-insert-file-contents nndoc-address)) (let ((coding-system-for-read 'binary))
(if (stringp nndoc-address) (mm-insert-file-contents nndoc-address))
(nnheader-insert-file-contents nndoc-address) (if (stringp nndoc-address)
(insert-buffer-substring nndoc-address)) (nnheader-insert-file-contents nndoc-address)
(run-hooks 'nndoc-open-document-hook))))) (insert-buffer-substring nndoc-address))
(run-hooks 'nndoc-open-document-hook))
(file-error
(nnheader-report 'nndoc "Couldn't open %s: %s"
group error))))))
;; Initialize the nndoc structures according to this new document. ;; Initialize the nndoc structures according to this new document.
(when (and nndoc-current-buffer (when (and nndoc-current-buffer
(not nndoc-dissection-alist)) (not nndoc-dissection-alist))