Fix ImageCache when loading full image

No need to append ImageType to path. loadfullimage==true already indicates that it's a full image.
This commit is contained in:
Vic 2022-12-28 15:07:26 +08:00
parent 786e3a0a0b
commit b5c48058cb

View file

@ -248,7 +248,7 @@ namespace Flow.Launcher.Infrastructure.Image
public static bool CacheContainImage(string path, bool loadFullImage = false) public static bool CacheContainImage(string path, bool loadFullImage = false)
{ {
return ImageCache.ContainsKey(path, false) && ImageCache[path, loadFullImage] != null; return ImageCache.ContainsKey(path, loadFullImage) && ImageCache[path, loadFullImage] != null;
} }
public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullImage = false) public static async ValueTask<ImageSource> LoadAsync(string path, bool loadFullImage = false)
@ -259,10 +259,6 @@ namespace Flow.Launcher.Infrastructure.Image
if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache) if (imageResult.ImageType != ImageType.Error && imageResult.ImageType != ImageType.Cache)
{ // we need to get image hash { // we need to get image hash
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null; string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
if (imageResult.ImageType == ImageType.FullImageFile)
{
path = $"{path}_{ImageType.FullImageFile}";
}
if (hash != null) if (hash != null)
{ {
@ -278,7 +274,7 @@ namespace Flow.Launcher.Infrastructure.Image
} }
// update cache // update cache
ImageCache[path, false] = img; ImageCache[path, loadFullImage] = img;
} }
return img; return img;