fix(email): generate random filename when attachment filenames are same upon inbound email (#18483)
Fix issue when an email has multiple inline images with the same filename. Currently the cid_map is overwritten; instead, attach the files with different names. Emails where every inline image has the filename 'image.png', only one of the images ends up correctly linked.
This commit is contained in:
parent
8222a60546
commit
01fe2da368
1 changed files with 3 additions and 0 deletions
|
|
@ -604,6 +604,9 @@ class Email:
|
|||
fname = get_random_filename(content_type=content_type)
|
||||
else:
|
||||
fname = get_random_filename(content_type=content_type)
|
||||
# Don't clobber existing filename
|
||||
while fname in self.cid_map:
|
||||
fname = get_random_filename(content_type=content_type)
|
||||
|
||||
self.attachments.append(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue