mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
Corrected bug that put the UTI instead of mimeType in retrieved assets
Summary: This pull request corrects a bug found in `RCTAssetsLibraryRequestHandler` which used the asset UTI as the mimeType. The code for finding the mimeType is based on the implementation used in `RCTImageLoader` and `RCTImageUtils`. Closes https://github.com/facebook/react-native/pull/7349 Differential Revision: D3252796 Pulled By: nicklockwood fb-gh-sync-id: b9303a99333e4744dfe23045f4a2755307305772 fbshipit-source-id: b9303a99333e4744dfe23045f4a2755307305772
This commit is contained in:
parent
46ba1532fd
commit
55c8158c44
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#import <AssetsLibrary/AssetsLibrary.h>
|
#import <AssetsLibrary/AssetsLibrary.h>
|
||||||
#import <libkern/OSAtomic.h>
|
#import <libkern/OSAtomic.h>
|
||||||
|
#import <MobileCoreServices/MobileCoreServices.h>
|
||||||
|
|
||||||
#import "RCTBridge.h"
|
#import "RCTBridge.h"
|
||||||
#import "RCTUtils.h"
|
#import "RCTUtils.h"
|
||||||
@ -54,9 +55,12 @@ RCT_EXPORT_MODULE()
|
|||||||
ALAssetRepresentation *representation = [asset defaultRepresentation];
|
ALAssetRepresentation *representation = [asset defaultRepresentation];
|
||||||
NSInteger length = (NSInteger)representation.size;
|
NSInteger length = (NSInteger)representation.size;
|
||||||
|
|
||||||
|
|
||||||
|
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass((__bridge CFStringRef _Nonnull)(representation.UTI), kUTTagClassMIMEType);
|
||||||
|
|
||||||
NSURLResponse *response =
|
NSURLResponse *response =
|
||||||
[[NSURLResponse alloc] initWithURL:request.URL
|
[[NSURLResponse alloc] initWithURL:request.URL
|
||||||
MIMEType:representation.UTI
|
MIMEType:(__bridge NSString *)(MIMEType)
|
||||||
expectedContentLength:length
|
expectedContentLength:length
|
||||||
textEncodingName:nil];
|
textEncodingName:nil];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user