diff --git a/ChangeLog b/ChangeLog index 912c9c482..f9f81746a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-05-16 Wolfgang Sourdeau + + * SoObjects/SOGo/NSString+Utilities.m ([NSString + -_rangeOfURLInRange:refRange]): urls cannot end with "&" nor "=". + There is no need to subscract the start from the length if a space + is not found since the range has not changed either. Finally, the + first character before the url might also be a tab or a cr, so we + match it against the "urlAfterEndingChars" custom NSCharacterSet. + 2007-05-15 Wolfgang Sourdeau * SoObjects/Appointments/SOGoAppointmentFolder.m diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 75ee19d21..e5912afbb 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -108,12 +108,12 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil; - (NSRange) _rangeOfURLInRange: (NSRange) refRange { int start, length; - NSRange endRange; + NSRange workRange; if (!urlNonEndingChars) { urlNonEndingChars = [NSMutableCharacterSet new]; - [urlNonEndingChars addCharactersInString: @",.:;\t \r\n"]; + [urlNonEndingChars addCharactersInString: @"&=,.:;\t \r\n"]; } if (!urlAfterEndingChars) { @@ -123,16 +123,16 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil; start = refRange.location; while (start > -1 - && [self characterAtIndex: start] != ' ') + && ![urlAfterEndingChars characterIsMember: + [self characterAtIndex: start]]) start--; start++; length = [self length] - start; - endRange = NSMakeRange (start, length); - endRange = [self rangeOfCharacterFromSet: urlAfterEndingChars - options: NSLiteralSearch range: endRange]; - if (endRange.location != NSNotFound) - length = endRange.location; - length -= start; + workRange = NSMakeRange (start, length); + workRange = [self rangeOfCharacterFromSet: urlAfterEndingChars + options: NSLiteralSearch range: workRange]; + if (workRange.location != NSNotFound) + length = workRange.location - start; while (length > 0 && [urlNonEndingChars characterIsMember: