diff --git a/ChangeLog b/ChangeLog index 0eeea2b02..16748be9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-06-01 Francis Lachapelle + + * SoObjects/SOGo/NSString+Utilities.m + (-_handleURLs:textToMatch:prefix:inRanges:): don't reset the + prefix for the subsequent matching strings. This fixes links in + messages with multiple email addresses, some of which already + prefixed by "mailto;". + 2012-06-01 Wolfgang Sourdeau * UI/MailPartViewers/UIxMailPartAlternativeViewer.m diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 1feb8537d..ec04b9795 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -215,13 +215,13 @@ static int cssEscapingCount; { rangePtr->location += offset; urlText = [selfCopy substringFromRange: *rangePtr]; - if ([urlText hasPrefix: prefix]) prefix = @""; newUrlText = [NSString stringWithFormat: @"%@", - prefix, urlText, urlText]; + ([urlText hasPrefix: prefix]? @"" : prefix), + urlText, urlText]; [selfCopy replaceCharactersInRange: *rangePtr - withString: newUrlText]; + withString: newUrlText]; offset += ([newUrlText length] - [urlText length]); - + // Add range for further substitutions currentUrlRange = NSMakeRange (rangePtr->location, [newUrlText length]); [ranges addNonNSObject: ¤tUrlRange @@ -240,12 +240,12 @@ static int cssEscapingCount; selfCopy = [NSMutableString stringWithString: self]; [self _handleURLs: selfCopy textToMatch: @"://" - prefix: @"" - inRanges: ranges]; + prefix: @"" + inRanges: ranges]; [self _handleURLs: selfCopy textToMatch: @"@" - prefix: @"mailto:" - inRanges: ranges]; + prefix: @"mailto:" + inRanges: ranges]; [ranges freeNonNSObjects]; return selfCopy;