Temp remove the assert when thumbnail cache key used with thumbnail context , this may be changed later

This commit is contained in:
DreamPiggy 2024-01-10 14:20:04 +08:00
parent 3eb8dd1439
commit 3782f772d6
2 changed files with 4 additions and 2 deletions

View File

@ -323,6 +323,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
* @param doneBlock The completion block. Will not get called if the operation is cancelled
*
* @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled
* @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
*/
- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
@ -335,6 +336,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
* @param doneBlock The completion block. Will not get called if the operation is cancelled
*
* @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancellederation, will callback immediately when cancelled
* @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
*/
- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;
@ -348,6 +350,7 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {
* @param doneBlock The completion block. Will not get called if the operation is cancelled
*
* @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled
* @warning If you query with thumbnail cache key, you'd better not pass the thumbnail pixel size context, which is undefined behavior.
*/
- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;

View File

@ -533,8 +533,7 @@ static NSString * _defaultDiskCacheDirectory;
// The disk -> memory sync logic, which should only store thumbnail image with thumbnail key
// 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
if (diskImage.sd_isThumbnail) {
NSAssert(!SDIsThumbnailKey(key), @"The input cache key %@ should not be thumbnail key", key);
if (diskImage.sd_isThumbnail && !SDIsThumbnailKey(key)) {
SDImageCoderOptions *options = diskImage.sd_decodeOptions;
CGSize thumbnailSize = CGSizeZero;
NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];