(fix) fix EAS download of attachments on iOS 10
This commit is contained in:
parent
ebd4058b11
commit
5f4acda249
|
@ -1539,6 +1539,7 @@ void handle_eas_terminate(int signum)
|
||||||
if ([[theResponse headerForKey: @"Content-Type"] isEqualToString:@"application/vnd.ms-sync.multipart"])
|
if ([[theResponse headerForKey: @"Content-Type"] isEqualToString:@"application/vnd.ms-sync.multipart"])
|
||||||
{
|
{
|
||||||
NSData *d;
|
NSData *d;
|
||||||
|
|
||||||
d = [currentBodyPart fetchBLOBWithPeek: YES];
|
d = [currentBodyPart fetchBLOBWithPeek: YES];
|
||||||
|
|
||||||
[s appendFormat: @"<Part>%d</Part>", i+1];
|
[s appendFormat: @"<Part>%d</Part>", i+1];
|
||||||
|
@ -1548,9 +1549,15 @@ void handle_eas_terminate(int signum)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSString *a;
|
NSString *a;
|
||||||
|
|
||||||
a = [[currentBodyPart fetchBLOBWithPeek: YES] activeSyncRepresentationInContext: context];
|
a = [[currentBodyPart fetchBLOBWithPeek: YES] activeSyncRepresentationInContext: context];
|
||||||
|
|
||||||
[s appendFormat: @"<Range>0-%d</Range>", [a length]-1];
|
// Don't send Range when not included in the request. Sending it will cause issue on iOS 10
|
||||||
|
// when downloading attachments. iOS 10 will first report an error upon the first download
|
||||||
|
// and then, it'll work. This makes it work the first time the attachment is downlaoded.
|
||||||
|
if ([[[(id)[aFetch getElementsByTagName: @"Range"] lastObject] textValue] length])
|
||||||
|
[s appendFormat: @"<Range>0-%d</Range>", [a length]-1];
|
||||||
|
|
||||||
[s appendFormat: @"<Data>%@</Data>", a];
|
[s appendFormat: @"<Data>%@</Data>", a];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue