Skip to content

Commit 75f4f00

Browse files
committed
Fixed not working for folders
1 parent 3583698 commit 75f4f00

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Files.App/ViewModels/ShellViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,21 +1098,21 @@ private async Task<bool> LoadThumbnailAsync(ListedItem item, IStorageItem matchi
10981098
var thumbnailMode = thumbnailSize < 96 ? ThumbnailMode.ListView : ThumbnailMode.SingleItem;
10991099

11001100
// We use ReturnOnlyIfCached because otherwise folders thumbnails have a black background, this has the downside the folder previews don't work
1101-
using StorageItemThumbnail Thumbnail = matchingStorageItem switch
1101+
using StorageItemThumbnail thumbnail = matchingStorageItem switch
11021102
{
11031103
BaseStorageFile file => await FilesystemTasks.Wrap(() => file.GetThumbnailAsync(thumbnailMode, thumbnailSize, ThumbnailOptions.ResizeThumbnail).AsTask()),
1104-
BaseStorageFolder folder => await FilesystemTasks.Wrap(() => folder.GetThumbnailAsync(thumbnailMode, thumbnailSize, ThumbnailOptions.ReturnOnlyIfCached).AsTask()),
1104+
BaseStorageFolder folder => await FilesystemTasks.Wrap(() => folder.GetThumbnailAsync(ThumbnailMode.SingleItem, thumbnailSize, ThumbnailOptions.ReturnOnlyIfCached).AsTask()),
11051105
_ => new (null!, FileSystemStatusCode.Generic)
11061106
};
11071107

1108-
if (Thumbnail is not null && Thumbnail.Size != 0 && Thumbnail.OriginalHeight != 0 && Thumbnail.OriginalWidth != 0)
1108+
if (thumbnail is not null && thumbnail.Size != 0 && thumbnail.OriginalHeight != 0 && thumbnail.OriginalWidth != 0)
11091109
{
11101110
await dispatcherQueue.EnqueueOrInvokeAsync(async () =>
11111111
{
11121112
var img = new BitmapImage();
11131113
img.DecodePixelType = DecodePixelType.Logical;
11141114
img.DecodePixelWidth = (int)thumbnailSize;
1115-
await img.SetSourceAsync(Thumbnail);
1115+
await img.SetSourceAsync(thumbnail);
11161116
item.FileImage = img;
11171117
}, Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal);
11181118

0 commit comments

Comments
 (0)