Restore attributes of base64-encoded img tags

Fixes #3814
This commit is contained in:
Francis Lachapelle
2016-11-23 14:57:24 -05:00
parent 1ff24dddfc
commit 3711e7d123
2 changed files with 16 additions and 3 deletions

2
NEWS
View File

@@ -1,5 +1,4 @@
2.3.18 (2016-11-DD)
-------------------
New features
- [eas] relaxed permission requirements for subscription synchronizations (#3118 and #3180)
@@ -17,6 +16,7 @@ Bug fixes
- [web] fixed support for recurrent tasks
- [web] improved validation of mail account delegators
- [web] allow edition of a mailbox rights when user can administer mailbox
- [web] restore attributes when rewriting base64-encoded img tags (#3814)
2.3.17 (2016-10-20)
-------------------

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)