From 3215760194f9d28f0053c38d9b2eb0942914615c Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 1 Oct 2022 16:56:19 +0200 Subject: [PATCH] Make mailcap--regexp-quote-type more resilient * lisp/net/mailcap.el (mailcap--regexp-quote-type): Make more resilient in the presence of junk. --- lisp/net/mailcap.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index b678df30bd4..aa0c1726553 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -1066,8 +1066,10 @@ If FORCE, re-parse even if already parsed." extns nil))))) (defun mailcap--regexp-quote-type (type) - (pcase-let ((`(,major ,minor) (split-string type "/"))) - (concat major "/" (regexp-quote minor)))) + (if (not (string-search "/" type)) + type + (pcase-let ((`(,major ,minor) (split-string type "/"))) + (concat major "/" (regexp-quote minor))))) (defun mailcap-extension-to-mime (extn) "Return the MIME content type of the file extensions EXTN." -- 2.39.2