diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m
index 0786ddf35..870a120e9 100644
--- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m
+++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m
@@ -576,28 +576,21 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
}
else if ([lowerName isEqualToString: @"img"])
{
- /* [resultPart appendString:
- @"src=\"/SOGo.woa/WebServerResources/empty.gif\""]; */
-
- //Check if the image is base64 ant not url
- NSUInteger i, c;
- BOOL isBase64 = NO;
- for (i = 0, c = [_attributes count]; i < c; i++) {
- NSString *type, *value;
- type = [_attributes nameAtIndex:i];
- if ([type isEqualToString:@"src"])
- {
- value = [_attributes valueAtIndex:i];
- if([value length] > 4 && [[value substringToIndex: 4] isEqualToString:@"data"])
- {
- isBase64 = YES;
- break;
- }
- }
- }
- if(!isBase64)
+ // Defer remote images until the user allows them. A
+ // data: src is inline. srcset is always deferred: it is
+ // a list of candidates that may contain remote ones,
+ // whatever the src is.
+ if ([name isEqualToString: @"srcset"]
+ || !([value length] > 4
+ && [[value substringToIndex: 4] isEqualToString: @"data"]))
name = [NSString stringWithFormat: @"unsafe-%@", name];
}
+ else if ([lowerName isEqualToString: @"source"]
+ && [name isEqualToString: @"srcset"])
+ {
+ // : deferred like
+ name = @"unsafe-srcset";
+ }
else
skipAttribute = YES;
}
@@ -894,6 +887,66 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
@end
+/*
+ Returns the ", safeCSS];
+ if ([unsafeCSS length])
+ [elements appendFormat: @"",
+ unsafeCSS];
+
+ return elements;
+}
+
@implementation UIxMailPartHTMLViewer
- (id) init
@@ -1061,9 +1114,7 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
css = [handler css];
if ([css length])
- cssContent
- = [NSString stringWithFormat: @"",
- [handler css]];
+ cssContent = _styleElementsForCSS (css);
else
cssContent = @"";
@@ -1233,9 +1284,7 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
css = [handler css];
if ([css length])
- cssContent
- = [NSString stringWithFormat: @"",
- [handler css]];
+ cssContent = _styleElementsForCSS (css);
else
cssContent = @"";
diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js
index eaf71e72c..6b21e559b 100644
--- a/UI/WebServerResources/js/Mailer/Message.service.js
+++ b/UI/WebServerResources/js/Mailer/Message.service.js
@@ -429,7 +429,7 @@
if (angular.isUndefined(part.unsafeContent)) {
part.unsafeContent = document.createElement('div');
part.unsafeContent.innerHTML = part.safeContent;
- angular.forEach(['src', 'srcset', 'data', 'classid', 'background', 'style', 'poster'], function (suffix) {
+ angular.forEach(['src', 'srcset', 'data', 'classid', 'background', 'style', 'poster', 'type'], function (suffix) {
var elements = part.unsafeContent.querySelectorAll('[unsafe-' + suffix + ']'),
element,
value,