GNU bug report logs - #61041
28.1; recipient-filename not set correctly in mml-insert-mime-headers

Previous Next

Package: emacs;

Reported by: Abdul-Lateef Haji-Ali <a.hajiali <at> hw.ac.uk>

Date: Tue, 24 Jan 2023 18:27:02 UTC

Severity: normal

Found in version 28.1

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Abdul-Lateef Haji-Ali <a.hajiali <at> hw.ac.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.1; recipient-filename not set correctly in mml-insert-mime-headers 
Date: Tue, 24 Jan 2023 16:42:12 +0000
In the function `mml-insert-mime-headers`, the part contents (in `cont`) is tested for `recipient-filename` on mml.el:938
However, that logic is inside an if statement on non-nil `parameters` which is returned from `(mml-parameter-string cont mml-content-disposition-parameters)`

The result is that if `cont` does not contain any of the fields in `mml-content-disposition-parameters`, as is the case when the part has a buffer without a file-name. The recipient-filename is not include in `Content-Disposition`.

If this is unintended, as I suspect it is, it can be fixed with the following patch, for example:

------------------------------------------------------------
--- lisp/gnus/mml.el
+++ lisp/gnus/mml.el
@@ -924,22 +924,23 @@
       (insert "\n"))
     (when (setq id (cdr (assq 'id cont)))
       (insert "Content-ID: " id "\n"))
-    (setq parameters
-	  (mml-parameter-string
-	   cont mml-content-disposition-parameters))
-    (when (or (setq disposition (cdr (assq 'disposition cont)))
-	      parameters)
-      (insert "Content-Disposition: "
-	      (or disposition
-		  (mml-content-disposition type (cdr (assq 'filename cont)))))
-      (when parameters
-	(let ((cont (copy-sequence cont)))
-	  ;; Set the file name to what's specified by the user.
-	  (when-let ((recipient-filename (cdr (assq 'recipient-filename cont))))
-	    (setcdr cont
-		    (cons (cons 'filename recipient-filename)
-			  (cdr cont))))
-	  (mml-insert-parameter-string
+    (let ((cont cont))
+      (when-let ((recipient-filename (cdr (assq 'recipient-filename cont))))
+        ;; Set the file name to what's specified by the user.
+        (setq cont (copy-sequence cont))
+	(setcdr cont
+		(cons (cons 'filename recipient-filename)
+		      (cdr cont))))
+      (setq parameters
+	    (mml-parameter-string
+	     cont mml-content-disposition-parameters))
+      (when (or (setq disposition (cdr (assq 'disposition cont)))
+	        parameters)
+        (insert "Content-Disposition: "
+	        (or disposition
+		    (mml-content-disposition type (cdr (assq 'filename cont)))))
+        (when parameters
+          (mml-insert-parameter-string
 	   cont mml-content-disposition-parameters)))
       (insert "\n"))
     (unless (eq encoding '7bit)
------------------------------------------------------------

-- Al

________________________________
Heriot-Watt University was founded in 1821 and is a registered Scottish charity (SC000278).




This bug report was last modified 2 years and 147 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.