fix(mail): wrap HTML part with HTML tags to render all content
parent
e71afc982e
commit
47075b40a2
|
@ -1,6 +1,6 @@
|
||||||
/* UIxMailPartHTMLViewer.m - this file is part of SOGo
|
/* UIxMailPartHTMLViewer.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2017 Inverse inc.
|
* Copyright (C) 2007-2019 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* This file is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -795,6 +795,7 @@ _xmlCharsetForCharset (NSString *charset)
|
||||||
{
|
{
|
||||||
NSObject <SaxXMLReader> *parser;
|
NSObject <SaxXMLReader> *parser;
|
||||||
NSData *preparsedContent;
|
NSData *preparsedContent;
|
||||||
|
NSMutableData *htmlContent;
|
||||||
NSString *s;
|
NSString *s;
|
||||||
|
|
||||||
xmlCharEncoding enc;
|
xmlCharEncoding enc;
|
||||||
|
@ -858,10 +859,17 @@ _xmlCharsetForCharset (NSString *charset)
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some broken email messages have some additionnal content outside the main HTML tags which are
|
||||||
|
// ignored by libxml.
|
||||||
|
// We surround the whole part with additional HTML tags to render all content.
|
||||||
|
htmlContent = [NSMutableData dataWithBytes: "<html>" length: 6];
|
||||||
|
[htmlContent appendData: preparsedContent];
|
||||||
|
[htmlContent appendBytes: "</html>" length: 7];
|
||||||
|
|
||||||
[handler setContentEncoding: enc];
|
[handler setContentEncoding: enc];
|
||||||
|
|
||||||
[parser setContentHandler: handler];
|
[parser setContentHandler: handler];
|
||||||
[parser parseFromSource: preparsedContent];
|
[parser parseFromSource: htmlContent];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) cssContent
|
- (NSString *) cssContent
|
||||||
|
|
Loading…
Reference in New Issue