See ChangeLog.

Monotone-Parent: 361e773d3d8846808f8d0ac504cac38d25cbff5c
Monotone-Revision: e9f628c74b83c2316c49865e04b473c6e202c332

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2012-02-07T23:08:46
This commit is contained in:
Francis Lachapelle 2012-02-07 23:08:46 +00:00
parent a8ae0e30f4
commit b159c2c879
2 changed files with 62 additions and 40 deletions

View file

@ -1,3 +1,9 @@
2012-02-10 Francis Lachapelle <flachapelle@inverse.ca>
* UI/MailPartViewers/UIxMailPartHTMLViewer.m
(-startElement:namespace:rawName:attributes:): we should not add
end tags to void tags (ex: <br>).
2012-02-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/JavascriptAPIExtensions.js

View file

@ -1,9 +1,10 @@
/* UIxMailPartHTMLViewer.m - this file is part of SOGo
*
* Copyright (C) 2007-2011 Inverse inc.
* Copyright (C) 2007-2012 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
*
* 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
@ -53,6 +54,10 @@
/* Tags that are forbidden within the body of the html content */
static NSArray *BannedTags = nil;
/* Tags that can't have any contents (no end tag)
See http://www.w3.org/TR/html5/syntax.html#void-elements */
static NSArray *VoidTags = nil;
static xmlCharEncoding
_xmlCharsetForCharset (NSString *charset)
{
@ -230,6 +235,8 @@ static NSData* _sanitizeContent(NSData *theData)
BannedTags = [[NSArray alloc] initWithObjects: @"script", @"frameset",
@"frame", @"iframe", @"applet", @"link",
@"base", @"meta", @"title", nil];
if (!VoidTags)
VoidTags = [[NSArray alloc] initWithObjects: @"br", @"hr", nil];
}
- (id) init
@ -411,6 +418,14 @@ static NSData* _sanitizeContent(NSData *theData)
resultPart = [NSMutableString string];
[resultPart appendFormat: @"<%@", _rawName];
if ([VoidTags containsObject: lowerName])
{
if (!ignoredContent)
ignoreTag = [lowerName copy];
ignoredContent++;
}
else
{
max = [_attributes count];
for (count = 0; count < max; count++)
{
@ -459,6 +474,7 @@ static NSData* _sanitizeContent(NSData *theData)
name, [value stringByReplacingString: @"\""
withString: @"\\\""]];
}
}
[resultPart appendString: @">"];
[result appendString: resultPart];