unique Content-IDs
Smattr opened this issue · 1 comments
We are embedding images in emails and then linking to them using Content-ID (CID) URLs. We use the index of the image in the email to construct the CID. Unfortunately, RFC 2111 has this to say about CIDs:
The Content-ID of a MIME body part is required to be globally unique.
I did not realize that "globally" here means across your entire message store (or even literally globally if you choose to take it that far). This is apparently an intentional feature to allow cross references in messages. It is a little bit crazy (displaying any email is O(n)
in the number of emails you have) but apparently iOS's mail app chooses to implement it at its word.
As a result, on iOS you occasionally see the wrong image displayed in a needtoknow email. To get the right email you need to force quit mail to flush its cache. We should just fix this by using a hash or even a UUID for CIDs.
Relatedly, this also probably explains why loading inline images sometimes stalls indefinitely on iOS. Some more discussion: