Set trackingName for RCTImageLoader requests

Reviewed By: javache

Differential Revision: D3600853

fbshipit-source-id: 46ef2d0e54e4ce417cc3d4138c8d8f60d5c34173
This commit is contained in:
Scott Wolchok 2016-07-22 16:55:49 -07:00 committed by Facebook Github Bot 6
parent 5f41769485
commit eb59ae8423
1 changed files with 9 additions and 3 deletions

View File

@ -296,10 +296,16 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
__block dispatch_block_t cancelLoad = nil;
__weak RCTImageLoader *weakSelf = self;
// Add missing png extension
if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
{
NSMutableURLRequest *mutableRequest = [request mutableCopy];
mutableRequest.URL = [NSURL fileURLWithPath:[request.URL.path stringByAppendingPathExtension:@"png"]];
[NSURLProtocol setProperty:@"RCTImageLoader"
forKey:@"trackingName"
inRequest:mutableRequest];
// Add missing png extension
if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
mutableRequest.URL = [NSURL fileURLWithPath:[request.URL.path stringByAppendingPathExtension:@"png"]];
}
request = mutableRequest;
}