Added the assert to check the current behavior that thumbnail key should not passed twice
This commit is contained in:
parent
64c5ff59a3
commit
0092f74b7f
|
@ -17,6 +17,14 @@
|
||||||
#import "SDCallbackQueue.h"
|
#import "SDCallbackQueue.h"
|
||||||
#import "SDImageTransformer.h" // TODO, remove this
|
#import "SDImageTransformer.h" // TODO, remove this
|
||||||
|
|
||||||
|
// TODO, remove this
|
||||||
|
static BOOL SDIsThumbnailKey(NSString *key) {
|
||||||
|
if ([key rangeOfString:@"-Thumbnail("].location != NSNotFound) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
@interface SDImageCacheToken ()
|
@interface SDImageCacheToken ()
|
||||||
|
|
||||||
@property (nonatomic, strong, nullable, readwrite) NSString *key;
|
@property (nonatomic, strong, nullable, readwrite) NSString *key;
|
||||||
|
@ -526,6 +534,7 @@ static NSString * _defaultDiskCacheDirectory;
|
||||||
// However, caller (like SDWebImageManager) will query full key, with thumbnail size, and get thubmnail image
|
// However, caller (like SDWebImageManager) will query full key, with thumbnail size, and get thubmnail image
|
||||||
// We should add a check here, currently it's a hack
|
// We should add a check here, currently it's a hack
|
||||||
if (diskImage.sd_isThumbnail) {
|
if (diskImage.sd_isThumbnail) {
|
||||||
|
NSAssert(!SDIsThumbnailKey(key), @"The input cache key %@ should not be thumbnail key", key);
|
||||||
SDImageCoderOptions *options = diskImage.sd_decodeOptions;
|
SDImageCoderOptions *options = diskImage.sd_decodeOptions;
|
||||||
CGSize thumbnailSize = CGSizeZero;
|
CGSize thumbnailSize = CGSizeZero;
|
||||||
NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];
|
NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];
|
||||||
|
|
|
@ -304,12 +304,7 @@ static id<SDImageLoader> _defaultImageLoader;
|
||||||
NSString *key = [self cacheKeyForURL:url context:context];
|
NSString *key = [self cacheKeyForURL:url context:context];
|
||||||
// to avoid the SDImageCache's sync logic use the mismatched cache key
|
// to avoid the SDImageCache's sync logic use the mismatched cache key
|
||||||
// we should strip the `thumbnail` related context
|
// we should strip the `thumbnail` related context
|
||||||
SDWebImageMutableContext *mutableContext;
|
SDWebImageMutableContext *mutableContext = [context mutableCopy];
|
||||||
if (context) {
|
|
||||||
mutableContext = [context mutableCopy];
|
|
||||||
} else {
|
|
||||||
mutableContext = [NSMutableDictionary dictionary];
|
|
||||||
}
|
|
||||||
mutableContext[SDWebImageContextImageThumbnailPixelSize] = nil;
|
mutableContext[SDWebImageContextImageThumbnailPixelSize] = nil;
|
||||||
mutableContext[SDWebImageContextImagePreserveAspectRatio] = nil;
|
mutableContext[SDWebImageContextImagePreserveAspectRatio] = nil;
|
||||||
@weakify(operation);
|
@weakify(operation);
|
||||||
|
|
Loading…
Reference in New Issue