Fixed crashes with IE7+8

Monotone-Parent: 33b6c38a250d6ae49e26dd7de548708c132d5c34
Monotone-Revision: 95ed8a2f8950868651d78738a3745fb83e43881a

Monotone-Author: crobert@inverse.ca
Monotone-Date: 2009-09-03T18:24:05
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
C Robert
2009-09-03 18:24:05 +00:00
parent 45420d434c
commit 207fff0117
4 changed files with 24 additions and 13 deletions
+12 -4
View File
@@ -707,7 +707,7 @@ static BOOL shouldDisplayWeekend = NO;
WORequest *request;
WOResponse *response;
NSString *fileContent;
NSData *data;
id data;
iCalCalendar *additions;
int i, count, imported;
@@ -715,9 +715,15 @@ static BOOL shouldDisplayWeekend = NO;
rc = [NSMutableDictionary dictionary];
request = [context request];
folder = [self clientObject];
data = (NSData *)[request formValueForKey: @"calendarFile"];
fileContent = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
[fileContent autorelease];
data = [request formValueForKey: @"calendarFile"];
if ([data respondsToSelector: @selector(isEqualToString:)])
fileContent = (NSString *) data;
else
{
fileContent = [[NSString alloc] initWithData: (NSData *) data
encoding: NSUTF8StringEncoding];
[fileContent autorelease];
}
if (fileContent && [fileContent length]
&& [fileContent hasPrefix: @"BEGIN:"])
@@ -759,6 +765,8 @@ static BOOL shouldDisplayWeekend = NO;
forKey: @"message"];
response = [self responseWithStatus: 200];
[response setHeader: @"text/html"
forKey: @"content-type"];
[(WOResponse*)response appendContentString: [rc jsonRepresentation]];
return response;
}