From 2e6e250521f5076bfa1afb32c24d0075d34b4c53 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 25 Aug 2019 07:57:30 +0200 Subject: [PATCH] Disallow just hitting RET in gnus-mime-replace-part * lisp/gnus/gnus-art.el (gnus-mime-replace-part): Don't replace the part if the file to replace it with doesn't exist (bug#36864). --- lisp/gnus/gnus-art.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 930b0a0510a..04cb087737f 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -5059,7 +5059,10 @@ and `gnus-mime-delete-part', and not provided at run-time normally." (list (read-file-name "Replace MIME part with file: " (or mm-default-directory default-directory) - nil nil))) + nil t))) + (unless (file-regular-p (file-truename file)) + (error "Can't replace part with %s, which isn't a regular file" + file)) (gnus-mime-save-part-and-strip file)) (defun gnus-mime-save-part-and-strip (&optional file) -- 2.39.2