fix(mail): don't lowercase href/action/formaction attribute value

Fixes #5434
This commit is contained in:
Francis Lachapelle
2021-11-26 08:34:45 -05:00
parent d484c2b8bd
commit c4bb0de11e

View File

@@ -446,7 +446,7 @@ _xmlCharsetForCharset (NSString *charset)
attributes: (id <SaxAttributes>) _attributes
{
unsigned int count, max;
NSString *name, *value, *cid, *lowerName;
NSString *name, *value, *cid, *lowerName, *lowerValue;
NSMutableString *resultPart;
BOOL skipAttribute;
@@ -518,11 +518,12 @@ _xmlCharsetForCharset (NSString *charset)
|| [name isEqualToString: @"action"]
|| [name isEqualToString: @"formaction"])
{
value = [[_attributes valueAtIndex: count] lowercaseString];
skipAttribute = ([value rangeOfString: @"://"].location == NSNotFound
&& ![value hasPrefix: @"mailto:"]
&& ![value hasPrefix: @"#"]) ||
[value hasPrefix: @"javascript:"];
value = [_attributes valueAtIndex: count];
lowerValue = [value lowercaseString];
skipAttribute = ([lowerValue rangeOfString: @"://"].location == NSNotFound
&& ![lowerValue hasPrefix: @"mailto:"]
&& ![lowerValue hasPrefix: @"#"]) ||
[lowerValue hasPrefix: @"javascript:"];
if (!skipAttribute)
[resultPart appendString: @" rel=\"noopener\""];
}