bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67002: 30.0.50; gnus-article-browse-html-save-cid-content could hand


From: Eli Zaretskii
Subject: bug#67002: 30.0.50; gnus-article-browse-html-save-cid-content could handle duplicate filenames better
Date: Sat, 18 Nov 2023 11:16:11 +0200

> From: "Dirk-Jan C. Binnema" <djcb@djcbsoftware.nl>
> Date: Wed, 08 Nov 2023 19:35:24 +0200
> 
> Dear Gnus,
> 
> This came up in a mu4e bug:
>   https://github.com/djcb/mu/issues/2460
> 
> (for reference: mu4e is /another/ Emacs MUA, which re-uses a lot of Gnus code)
> 
> Basically, in the attached html-email there are _two_ CIDs with the same
> filename (but with different content-ids)
> 
> When doing a view-in-browser, gnus-article-browse-html-save-cid-content
> uses the filename in favor of the cid, and the first file will be
> overwritten by the second.
> 
> Admittedly, a corner-case. But, it can be fixed.
> This fixes it for me:
> 
> --8<---------------cut here---------------start------------->8---
> @@ -2871,11 +2871,14 @@ gnus-article-browse-html-save-cid-content
>                             cid handle directory))
>             (throw 'found file)))
>          ((equal (concat "<" cid ">") (mm-handle-id handle))
> -         (setq file (or (mm-handle-filename handle)
> -                        (concat
> -                         (make-temp-name "cid")
> -                         (car (rassoc (car (mm-handle-type handle))
> -                                      mailcap-mime-extensions))))
> +         ;; Files are randomized since declared filenames may not be unique.
> +         (setq file (format "cid-%d-%s"
> +                            (random 99)
> +                            (or (mm-handle-filename handle)
> +                                (concat
> +                                 (make-temp-name "cid")
> +                                 (car (rassoc (car (mm-handle-type handle))
> +                                              mailcap-mime-extensions)))))
>                 afile (expand-file-name file directory))
> --8<---------------cut here---------------end--------------->8---

Eric, Andrew: any comments?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]