[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: |
Dirk-Jan C. Binnema |
Subject: |
bug#67002: 30.0.50; gnus-article-browse-html-save-cid-content could handle duplicate filenames better |
Date: |
Wed, 08 Nov 2023 19:35:24 +0200 |
User-agent: |
mu4e 1.11.24; emacs 30.0.50 |
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---
Kind regards,
Dirk.
image_issue_email.txt
Description: Example message
- bug#67002: 30.0.50; gnus-article-browse-html-save-cid-content could handle duplicate filenames better,
Dirk-Jan C. Binnema <=