Ignore the dynamic UTI type hint to avoid extra log
This commit is contained in:
parent
f6769186b9
commit
c81aec4ccd
|
@ -35,6 +35,10 @@ SDImageCoderOptions * _Nonnull SDGetDecodeOptionsFromContext(SDWebImageContext *
|
|||
if (!typeIdentifierHint) {
|
||||
// UTI has high priority
|
||||
fileExtensionHint = cacheKey.pathExtension; // without dot
|
||||
if (fileExtensionHint.length == 0) {
|
||||
// Ignore file extension which is empty
|
||||
fileExtensionHint = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// First check if user provided decode options
|
||||
|
@ -71,7 +75,11 @@ void SDSetDecodeOptionsToContext(SDWebImageMutableContext * _Nonnull mutableCont
|
|||
if (!typeIdentifierHint) {
|
||||
NSString *fileExtensionHint = decodeOptions[SDImageCoderDecodeFileExtensionHint];
|
||||
if (fileExtensionHint) {
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, NULL);
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, kUTTypeImage);
|
||||
// Ignore dynamic UTI
|
||||
if (UTTypeIsDynamic((__bridge CFStringRef)typeIdentifierHint)) {
|
||||
typeIdentifierHint = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
mutableContext[SDWebImageContextImageTypeIdentifierHint] = typeIdentifierHint;
|
||||
|
|
|
@ -372,7 +372,11 @@ static CGImageRef __nullable SDCGImageCreateCopy(CGImageRef cg_nullable image) {
|
|||
// Check file extension and convert to UTI, from: https://stackoverflow.com/questions/1506251/getting-an-uniform-type-identifier-for-a-given-extension
|
||||
NSString *fileExtensionHint = options[SDImageCoderDecodeFileExtensionHint];
|
||||
if (fileExtensionHint) {
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, NULL);
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, kUTTypeImage);
|
||||
// Ignore dynamic UTI
|
||||
if (UTTypeIsDynamic((__bridge CFStringRef)typeIdentifierHint)) {
|
||||
typeIdentifierHint = nil;
|
||||
}
|
||||
}
|
||||
} else if ([typeIdentifierHint isEqual:NSNull.null]) {
|
||||
// Hack if user don't want to imply file extension
|
||||
|
|
|
@ -124,7 +124,11 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination
|
|||
// Check file extension and convert to UTI, from: https://stackoverflow.com/questions/1506251/getting-an-uniform-type-identifier-for-a-given-extension
|
||||
NSString *fileExtensionHint = options[SDImageCoderDecodeFileExtensionHint];
|
||||
if (fileExtensionHint) {
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, NULL);
|
||||
typeIdentifierHint = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtensionHint, kUTTypeImage);
|
||||
// Ignore dynamic UTI
|
||||
if (UTTypeIsDynamic((__bridge CFStringRef)typeIdentifierHint)) {
|
||||
typeIdentifierHint = nil;
|
||||
}
|
||||
}
|
||||
} else if ([typeIdentifierHint isEqual:NSNull.null]) {
|
||||
// Hack if user don't want to imply file extension
|
||||
|
|
Loading…
Reference in New Issue