respect any CDN headers (eg Host for front)

pull/2/head
Michael Kirk 6 years ago
parent 3fb8b02b3b
commit 1fae83a777

@ -1233,10 +1233,19 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
});
};
NSURL *avatarUrlPath =
[NSURL URLWithString:userProfile.avatarUrlPath relativeToURL:self.avatarHTTPManager.baseURL];
NSURLRequest *request = [NSURLRequest requestWithURL:avatarUrlPath];
NSURLSessionDownloadTask *downloadTask = [self.avatarHTTPManager downloadTaskWithRequest:request
NSURL *avatarUrl = [NSURL URLWithString:userProfile.avatarUrlPath relativeToURL:self.avatarHTTPManager.baseURL];
NSError *serializationError;
NSMutableURLRequest *request =
[self.avatarHTTPManager.requestSerializer requestWithMethod:@"GET"
URLString:avatarUrl.absoluteString
parameters:nil
error:&serializationError];
if (serializationError) {
OWSFailDebug(@"serializationError: %@", serializationError);
return;
}
__block NSURLSessionDownloadTask *downloadTask = [self.avatarHTTPManager downloadTaskWithRequest:request
progress:^(NSProgress *_Nonnull downloadProgress) {
OWSLogVerbose(
@"Downloading avatar for %@ %f", userProfile.recipientId, downloadProgress.fractionCompleted);

Loading…
Cancel
Save