Skip to content

Commit

Permalink
Back out "Avoid re-encoding images when uploading local files"
Browse files Browse the repository at this point in the history
Summary:
This was causing an upload error in FB Dating, will need to re-land with the fix.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D29320144

fbshipit-source-id: 5d09dd2171b5696afe89cffa064947f0a0bb413d
  • Loading branch information
Peter Argany authored and facebook-github-bot committed Jun 23, 2021
1 parent f33e6f0 commit e83feff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
2 changes: 0 additions & 2 deletions Libraries/Network/RCTNetworking.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request
completionBlock:(RCTURLRequestCompletionBlock)completionBlock;

- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id<RCTURLRequestHandler>)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock;

- (void)addRequestHandler:(id<RCTNetworkingRequestHandler>)handler;

- (void)addResponseHandler:(id<RCTNetworkingResponseHandler>)handler;
Expand Down
18 changes: 2 additions & 16 deletions Libraries/Network/RCTNetworking.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#import <React/RCTUtils.h>

#import <React/RCTHTTPRequestHandler.h>
#import <React/RCTFileRequestHandler.h>

#import "RCTNetworkPlugins.h"

Expand Down Expand Up @@ -394,9 +393,9 @@ - (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(nullable NSDictionary
}
NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]];
if (request) {

__block RCTURLRequestCancellationBlock cancellationBlock = nil;
id<RCTURLRequestHandler> handler = [self.moduleRegistry moduleForName:"FileRequestHandler"];
RCTNetworkTask *task = [self networkTaskWithRequest:request handler:handler completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
RCTNetworkTask *task = [self networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
dispatch_async(self->_methodQueue, ^{
cancellationBlock = callback(error, data ? @{@"body": data, @"contentType": RCTNullIfNil(response.MIMEType)} : nil);
});
Expand Down Expand Up @@ -677,19 +676,6 @@ - (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request completionBlo
return task;
}

- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id<RCTURLRequestHandler>)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock
{
if (!handler) {
// specified handler is nil, fall back to generic method
return [self networkTaskWithRequest:request completionBlock:completionBlock];
}
RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithRequest:request
handler:handler
callbackQueue:_methodQueue];
task.completionBlock = completionBlock;
return task;
}

#pragma mark - JS API

RCT_EXPORT_METHOD(sendRequest:(JS::NativeNetworkingIOS::SpecSendRequestQuery &)query
Expand Down

0 comments on commit e83feff

Please sign in to comment.