Restore attributes of base64-encoded img tags

Fixes #3814
This commit is contained in:
Francis Lachapelle committed 2016-11-23 15:18:17 -05:00
1 parent 1ff24dddfc
commit 3711e7d123
2 files changed
+16 -3

No files matched your search

+15 -2
View File
@@ -296,7 +296,7 @@
//
if ([value length] > 5 && [[value substringToIndex: 5] caseInsensitiveCompare: @"data:"] == NSOrderedSame)
{
NSString *uniqueId, *mimeType, *encoding;
NSString *uniqueId, *mimeType, *encoding, *attrName;
NGMimeBodyPart *bodyPart;
NGMutableHashMap *map;
NSData *data;
@@ -351,8 +351,21 @@
[body release];
[images addObject: bodyPart];
[result appendFormat: @"<img src=\"cid:%@\" type=\"%@\"", uniqueId, mimeType];
// Restore img attributes
for (i = 0; i < [attributes count]; i++)
{
attrName = [[attributes rawNameAtIndex: i] lowercaseString];
if (![attrName isEqualToString: @"src"] && ![attrName isEqualToString: @"type"])
{
value = [attributes valueAtIndex: i];
[result appendFormat: @" %@=\"%@\"", attrName, value];
}
}
[result appendFormat: @"<img src=\"cid:%@\" type=\"%@\"/>", uniqueId, mimeType];
[result appendString: @"/>"];
}
}
else if (voidTags)