diff --git a/ChangeLog b/ChangeLog index e689671cd..e0c25c37e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-10-14 Francis Lachapelle + + * SoObjects/SOGo/NSString+Utilities.m (-_rangeOfURLInRange:): + fixed handling of brackets (inequality signs <>). + 2011-10-14 Ludovic Marcotte * SoObjects/SOGo/SOGoGCSFolder.m (setRoles:forUser:..) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index ceac40666..094dd595d 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -142,6 +142,12 @@ static int cssEscapingCount; [self characterAtIndex: start]]) start--; start++; + + // In [UIxMailPartTextViewer flatContentAsString], we first escape HTML entities and then + // add URLs. Therefore, the brackets (inequality signs <>) have been encoded at this point. + if ([[self substringWithRange: NSMakeRange (start, 4)] compare: @"<"] == NSOrderedSame) + start += 4; + length = [self length] - start; workRange = NSMakeRange (start, length); workRange = [self rangeOfCharacterFromSet: urlAfterEndingChars @@ -154,6 +160,11 @@ static int cssEscapingCount; [self characterAtIndex: (start + length - 1)]]) length--; + // Remove trailing ">" + if (([self length] >= start + length + 1) + && [[self substringWithRange: NSMakeRange (start, length + 1)] hasSuffix: @">"]) + length -= 3; + return NSMakeRange (start, length); }