diff --git a/packages/react-native/Libraries/Blob/RCTBlobManager.mm b/packages/react-native/Libraries/Blob/RCTBlobManager.mm index 8a4b6740ea1..4a29b1f826c 100755 --- a/packages/react-native/Libraries/Blob/RCTBlobManager.mm +++ b/packages/react-native/Libraries/Blob/RCTBlobManager.mm @@ -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]), }; }