mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
Revert D14425373: [react-native][PR] [iOS] Remove explicitly add png file extension when load local image
Differential Revision: D14425373 Original commit changeset: 3cc06c9a3d68 fbshipit-source-id: eef2ee9a459c35dcb30e0c023eb24854529149be
This commit is contained in:
committed by
Facebook Github Bot
parent
b3c74967ca
commit
95b05c0d82
@@ -380,6 +380,11 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
[NSURLProtocol setProperty:@"RCTImageLoader"
|
||||
forKey:@"trackingName"
|
||||
inRequest:mutableRequest];
|
||||
|
||||
// Add missing png extension
|
||||
if (request.URL.fileURL && request.URL.pathExtension.length == 0) {
|
||||
mutableRequest.URL = [request.URL URLByAppendingPathExtension:@"png"];
|
||||
}
|
||||
if (_redirectDelegate != nil) {
|
||||
mutableRequest.URL = [_redirectDelegate redirectAssetsURL:mutableRequest.URL];
|
||||
}
|
||||
|
||||
@@ -711,6 +711,9 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
||||
if (!image) {
|
||||
// Attempt to load from the file system
|
||||
NSString *filePath = [NSString stringWithUTF8String:[imageURL fileSystemRepresentation]];
|
||||
if (filePath.pathExtension.length == 0) {
|
||||
filePath = [filePath stringByAppendingPathExtension:@"png"];
|
||||
}
|
||||
image = [UIImage imageWithContentsOfFile:filePath];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user