Rewrite URLs to inline images in HTML attachments
|Assignee:||Hiroyuki Yamamoto||% Done:|
This adds to procmime a function for retrieving a MIME attachment and its associated multipart/related attachments, while rewriting cid URLs. Specifically, if the attachment is text/html and in a multipart/related container, the attachment body is scanned and every instance of cid:X is replaced with the filename of the corresponding attachment with Content-ID X. The body with these replacements is written to a file and the attachments are saved to the temp directory. In MimeView, the actions to open the attachment or open it with an application are changed to use this feature.
This change makes it possible to view HTML emails with inline attached images when opening the HTML attachment in a browser (for multipart/related, not multipart/mixed with content-disposition inline). It is a bit of a hack, since it doesn't examine the HTML structure it could rewrite a cid: string that is not actually an image URL. However, it generally works. There are some cases in which it fails and produces some duplicate data, which I have not yet been able to fix.