Skip to content

Commit 94336cf

Browse files
authored
Fix: Fixed issue where archive files were incorrectly grouped by size (#11222)
1 parent 68ce757 commit 94336cf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Files.App/Helpers/ItemListDisplayHelpers/GroupingHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static Func<ListedItem, string> GetItemGroupKeySelector(GroupOption optio
1818
return option switch
1919
{
2020
GroupOption.Name => x => new string(x.Name.Take(1).ToArray()).ToUpperInvariant(),
21-
GroupOption.Size => x => x.PrimaryItemAttribute != StorageItemTypes.Folder ? GetGroupSizeKey(x.FileSizeBytes) : x.FileSizeDisplay,
21+
GroupOption.Size => x => x.PrimaryItemAttribute != StorageItemTypes.Folder || x.IsArchive ? GetGroupSizeKey(x.FileSizeBytes) : x.FileSizeDisplay,
2222
GroupOption.DateCreated => x => dateTimeFormatter.ToTimeSpanLabel(x.ItemDateCreatedReal).Text,
2323
GroupOption.DateModified => x => dateTimeFormatter.ToTimeSpanLabel(x.ItemDateModifiedReal).Text,
2424
GroupOption.FileType => x => x.PrimaryItemAttribute == StorageItemTypes.Folder && !x.IsShortcut ? x.ItemType : x.FileExtension?.ToLowerInvariant() ?? " ",
@@ -60,7 +60,7 @@ public static (Action<GroupedCollection<ListedItem>>, Action<GroupedCollection<L
6060
GroupOption.Size => (x =>
6161
{
6262
var first = x.First();
63-
if (first.PrimaryItemAttribute != StorageItemTypes.Folder)
63+
if (first.PrimaryItemAttribute != StorageItemTypes.Folder || first.IsArchive)
6464
{
6565
var vals = GetGroupSizeInfo(first.FileSizeBytes);
6666
//x.Model.Text = vals.text;

src/Files.App/ViewModels/ItemViewModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,17 @@ private void OrderGroups(CancellationToken token = default)
710710
{
711711
if (folderSettings.DirectoryGroupOption == GroupOption.Size)
712712
// Always show file sections below folders
713-
FilesAndFolders.GroupedCollection.Order(x => x.OrderBy(y => y.First().PrimaryItemAttribute != StorageItemTypes.Folder).ThenBy(y => y.Model.SortIndexOverride).ThenBy(y => y.Model.Text));
713+
FilesAndFolders.GroupedCollection.Order(x => x.OrderBy(y => y.First().PrimaryItemAttribute != StorageItemTypes.Folder || y.First().IsArchive)
714+
.ThenBy(y => y.Model.SortIndexOverride).ThenBy(y => y.Model.Text));
714715
else
715716
FilesAndFolders.GroupedCollection.Order(x => x.OrderBy(y => y.Model.SortIndexOverride).ThenBy(y => y.Model.Text));
716717
}
717718
else
718719
{
719720
if (folderSettings.DirectoryGroupOption == GroupOption.Size)
720721
// Always show file sections below folders
721-
FilesAndFolders.GroupedCollection.Order(x => x.OrderBy(y => y.First().PrimaryItemAttribute != StorageItemTypes.Folder).ThenByDescending(y => y.Model.SortIndexOverride).ThenByDescending(y => y.Model.Text));
722+
FilesAndFolders.GroupedCollection.Order(x => x.OrderBy(y => y.First().PrimaryItemAttribute != StorageItemTypes.Folder || y.First().IsArchive)
723+
.ThenByDescending(y => y.Model.SortIndexOverride).ThenByDescending(y => y.Model.Text));
722724
else
723725
FilesAndFolders.GroupedCollection.Order(x => x.OrderByDescending(y => y.Model.SortIndexOverride).ThenByDescending(y => y.Model.Text));
724726
}

0 commit comments

Comments
 (0)