From: helge Date: Mon, 18 Jul 2005 12:27:09 +0000 (+0000) Subject: fixed a bug in subject handling X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdd25a960d4a065a7df9a1c40d55f3d77deab3cc;p=scalable-opengroupware.org fixed a bug in subject handling git-svn-id: http://svn.opengroupware.org/SOGo/trunk@787 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index 6b97920e..4d1fd8fe 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,3 +1,9 @@ +2005-07-18 Helge Hess + + * UIxSubjectFormatter.m: fixed a stupid bug in subject handling leading + to an infinite loop in the QP processing, hardened against QP loops + (v0.9.143) + 2005-07-18 Marcus Mueller * UIxMailEditor.m: removed -emailForUser usage and replaced with diff --git a/SOGo/UI/MailerUI/UIxSubjectFormatter.m b/SOGo/UI/MailerUI/UIxSubjectFormatter.m index 60647c66..683fd3ad 100644 --- a/SOGo/UI/MailerUI/UIxSubjectFormatter.m +++ b/SOGo/UI/MailerUI/UIxSubjectFormatter.m @@ -95,9 +95,9 @@ static Class DataClass = Nil; NSString *s, *r; unsigned len; - if ((len = [_subject length] == 0)) + if ((len = [_subject length]) == 0) return [self missingSubjectLabel]; - + /* check for quoted printable */ if (len > 6 && [self shouldDecodeQP]) { @@ -111,13 +111,15 @@ static Class DataClass = Nil; t = [_subject decodeQuotedPrintableValueOfMIMEHeaderField:@"subject"]; if ([t isNotNull]) return [self stringForObjectValue:t]; + else + [self warnWithFormat:@"decoding QP failed: '%@'", t]; } } /* continue NSData processing */ - [self warnWithFormat:@"NSData subject! (using UTF-8 to decode!)"]; - + [self warnWithFormat:@"NSData subject, using UTF-8 to decode."]; + // TODO: exception handler? s = [[NSString alloc] initWithData:_subject encoding:NSUTF8StringEncoding]; if (s == nil) { @@ -125,7 +127,12 @@ static Class DataClass = Nil; return [self labelForKey:@"Error_CouldNotDecodeSubject"]; } - r = [[self stringForStringValue:s] copy]; + if ([s hasPrefix:@"=?"]) { // TODO: this should never happen? + [self warnWithFormat:@"subject still has QP signature: '%@'", s]; + r = [s copy]; + } + else + r = [[self stringForStringValue:s] copy]; [s release]; return [r autorelease]; } diff --git a/SOGo/UI/MailerUI/Version b/SOGo/UI/MailerUI/Version index af05addd..998a6a82 100644 --- a/SOGo/UI/MailerUI/Version +++ b/SOGo/UI/MailerUI/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=142 +SUBMINOR_VERSION:=143 # v0.9.140 requires SoObjects/Mailer v0.9.100 # v0.9.134 requires libSOGo v0.9.41