Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-native/Libraries/Blob/RCTBlobManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,16 @@ - (id)handleNetworkingResponse:(NSURLResponse *)response data:(NSData *)data
// An empty body will have nil for data, in this case we need to return
// an empty blob as per the XMLHttpRequest spec.
data = data ?: [NSData new];
// -[NSURLResponse suggestedFilename] resolves the filename through a
// CoreServices/UTType XPC lookup that can crash intermittently
// (NSXPCEncoder) when called off the main thread. Since whatwg-fetch reads
// every response as a blob, that lookup used to run for every network
// response. Derive the name from the URL instead; no XPC round-trip.
return @{
@"blobId" : [self store:data],
@"offset" : @0,
@"size" : @(data.length),
@"name" : RCTNullIfNil([response suggestedFilename]),
@"name" : RCTNullIfNil(response.URL.lastPathComponent),
@"type" : RCTNullIfNil([response MIMEType]),
};
}
Expand Down
Loading