]> git.eshelyaron.com Git - emacs.git/commitdiff
Disallow just hitting RET in gnus-mime-replace-part
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 25 Aug 2019 05:57:30 +0000 (07:57 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 25 Aug 2019 05:57:30 +0000 (07:57 +0200)
* 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

index 930b0a0510ab618fc02bf2107340a61b848acf5f..04cb087737f956675aba8aedd670ec0f51f80545 100644 (file)
@@ -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)