File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ - (RCTImageLoaderCancellationBlock)_loadImageOrDataWithURLRequest:(NSURLRequest
314314
315315 // Add missing png extension
316316 if (request.URL .fileURL && request.URL .pathExtension .length == 0 ) {
317- mutableRequest.URL = [NSURL fileURLWithPath: [ request.URL.path stringByAppendingPathExtension :@" png" ] ];
317+ mutableRequest.URL = [request.URL URLByAppendingPathExtension :@" png" ];
318318 }
319319 request = mutableRequest;
320320 }
Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ BOOL RCTIsGzippedData(NSData *__nullable data)
602602 // Not a file path
603603 return nil ;
604604 }
605- NSString *path = URL. path ;
605+ NSString *path = [ NSString stringWithUTF8String: [ URL fileSystemRepresentation ]] ;
606606 NSString *bundlePath = [[NSBundle mainBundle ] resourcePath ];
607607 if (![path hasPrefix: bundlePath]) {
608608 // Not a bundle-relative file
@@ -678,11 +678,13 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL)
678678
679679 if (!image) {
680680 // Attempt to load from the file system
681- NSString *filePath = imageURL.path ;
682- if (filePath.pathExtension .length == 0 ) {
683- filePath = [filePath stringByAppendingPathExtension: @" png" ];
681+ NSData *fileData;
682+ if (imageURL.pathExtension .length == 0 ) {
683+ fileData = [NSData dataWithContentsOfURL: [imageURL URLByAppendingPathExtension: @" png" ]];
684+ } else {
685+ fileData = [NSData dataWithContentsOfURL: imageURL];
684686 }
685- image = [UIImage imageWithContentsOfFile: filePath ];
687+ image = [UIImage imageWithData: fileData ];
686688 }
687689
688690 if (!image && !bundle) {
You can’t perform that action at this time.
0 commit comments