unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61041: 28.1; recipient-filename not set correctly in mml-insert-mime-headers
@ 2023-01-24 16:42 Abdul-Lateef Haji-Ali via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; only message in thread
From: Abdul-Lateef Haji-Ali via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-24 16:42 UTC (permalink / raw)
  To: 61041


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).





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-24 16:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 16:42 bug#61041: 28.1; recipient-filename not set correctly in mml-insert-mime-headers Abdul-Lateef Haji-Ali via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).