Subject: 31.0.50; rfc6068-parse-mailto-url may fail with inhibit-eol-conversion

From: Kazuhiro Ito <[email-masked]>
Date: Sun, 13 Apr 2025 20:08:20 +0900

Following code returns unexpected result.

(let ((inhibit-eol-conversion t))
  (require 'rfc6068)
  (rfc6068-parse-mailto-url
   (concat "mailto:[email-masked]?body="
	   "send%20current-issue%0D%0Asend%20index")))

-> (("To" . "[email-masked]") ("Body" . "send current-issue^M
send index"))

Expected result is

-> (("To" . "[email-masked]") ("Body" . "send current-issue
send index"))

Furthermore, if URL contains "%0D%0A" and "%0A", though it is not
compliant with RFC 6068, "%0D%0A" may be decoded  CRLF, not LF.

-- 
Kazuhiro Ito
>From a4905fa8a369a30f691866b4e68fa11ea9cbc9e4 Mon Sep 17 00:00:00 2001
From: Kazuhiro Ito <[email-masked]>
Date: Sun, 13 Apr 2025 20:00:44 +0900
Subject: [PATCH] Fix rfc6068-parse-mailto-url with inhibit-eol-conversion

* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url): Fix EOL type to
CRLF and never inhibit EOL conversion in decoding.
---
 lisp/mail/rfc6068.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/mail/rfc6068.el b/lisp/mail/rfc6068.el
index 8f0b4234410..cfa51196000 100644
--- a/lisp/mail/rfc6068.el
+++ b/lisp/mail/rfc6068.el
@@ -39,7 +39,8 @@ rfc6068-unhexify-string
            (buffer-string))))
     (if inhibit-decode
         string
-      (decode-coding-string string 'utf-8))))
+      (let (inhibit-eol-conversion)
+        (decode-coding-string string 'utf-8-dos)))))
 
 (defun rfc6068-parse-mailto-url (mailto-url)
   "Parse MAILTO-URL, and return an alist of header-name, header-value pairs.
-- 
2.45.1