Skip to content

Commit c813b0b

Browse files
committed
Case insensitive comparison to match source => result (fix history)
1 parent bcf0471 commit c813b0b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Files.Uwp/Filesystem/FilesystemOperations/ShellFilesystemOperations.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public async Task<IStorageHistory> CopyItemsAsync(IList<IStorageItemWithPath> so
140140
var copiedSources = copyResult.Items.Where(x => x.Succeeded && x.Destination != null && x.Source != x.Destination);
141141
if (copiedSources.Any())
142142
{
143-
var sourceMatch = await copiedSources.Select(x => sourceRename.SingleOrDefault(s => s.Path == x.Source)).Where(x => x != null).ToListAsync();
143+
var sourceMatch = await copiedSources.Select(x => sourceRename
144+
.SingleOrDefault(s => s.Path.Equals(x.Source, StringComparison.OrdinalIgnoreCase))).Where(x => x != null).ToListAsync();
144145
return new StorageHistory(FileOperationType.Copy,
145146
sourceMatch,
146147
await copiedSources.Zip(sourceMatch, (rSrc, oSrc) => new { rSrc, oSrc })
@@ -363,7 +364,8 @@ public async Task<IStorageHistory> DeleteItemsAsync(IList<IStorageItemWithPath>
363364
var recycledSources = deleteResult.Items.Where(x => x.Succeeded && x.Destination != null && x.Source != x.Destination);
364365
if (recycledSources.Any())
365366
{
366-
var sourceMatch = await recycledSources.Select(x => source.DistinctBy(x => x.Path).SingleOrDefault(s => s.Path == x.Source)).Where(x => x != null).ToListAsync();
367+
var sourceMatch = await recycledSources.Select(x => source.DistinctBy(x => x.Path)
368+
.SingleOrDefault(s => s.Path.Equals(x.Source, StringComparison.OrdinalIgnoreCase))).Where(x => x != null).ToListAsync();
367369
return new StorageHistory(FileOperationType.Recycle,
368370
sourceMatch,
369371
await recycledSources.Zip(sourceMatch, (rSrc, oSrc) => new { rSrc, oSrc })
@@ -480,7 +482,8 @@ public async Task<IStorageHistory> MoveItemsAsync(IList<IStorageItemWithPath> so
480482
var movedSources = moveResult.Items.Where(x => x.Succeeded && x.Destination != null && x.Source != x.Destination);
481483
if (movedSources.Any())
482484
{
483-
var sourceMatch = await movedSources.Select(x => sourceRename.SingleOrDefault(s => s.Path == x.Source)).Where(x => x != null).ToListAsync();
485+
var sourceMatch = await movedSources.Select(x => sourceRename
486+
.SingleOrDefault(s => s.Path.Equals(x.Source, StringComparison.OrdinalIgnoreCase))).Where(x => x != null).ToListAsync();
484487
return new StorageHistory(FileOperationType.Move,
485488
sourceMatch,
486489
await movedSources.Zip(sourceMatch, (rSrc, oSrc) => new { rSrc, oSrc })
@@ -619,7 +622,8 @@ public async Task<IStorageHistory> RestoreItemsFromTrashAsync(IList<IStorageItem
619622
var movedSources = moveResult.Items.Where(x => x.Succeeded && x.Destination != null && x.Source != x.Destination);
620623
if (movedSources.Any())
621624
{
622-
var sourceMatch = await movedSources.Select(x => source.SingleOrDefault(s => s.Path == x.Source)).Where(x => x != null).ToListAsync();
625+
var sourceMatch = await movedSources.Select(x => source
626+
.SingleOrDefault(s => s.Path.Equals(x.Source, StringComparison.OrdinalIgnoreCase))).Where(x => x != null).ToListAsync();
623627
// Recycle bin also stores a file starting with $I for each item
624628
await DeleteItemsAsync(await movedSources.Zip(sourceMatch, (rSrc, oSrc) => new { rSrc, oSrc })
625629
.Select(src => StorageHelpers.FromPathAndType(

0 commit comments

Comments
 (0)