@@ -224,7 +224,7 @@ public async Task<IStorageHistory> DeleteItemsAsync(IList<IStorageItemWithPath>
224
224
return await filesystemOperations . DeleteItemsAsync ( source , progress , errorCode , permanently , cancellationToken ) ;
225
225
}
226
226
227
- var deleleFilePaths = source . Select ( s => s . Path ) ;
227
+ var deleleFilePaths = source . Select ( s => s . Path ) . Distinct ( ) ;
228
228
var deleteFromRecycleBin = source . Any ( ) ? recycleBinHelpers . IsPathUnderRecycleBin ( source . ElementAt ( 0 ) . Path ) : false ;
229
229
permanently |= deleteFromRecycleBin ;
230
230
@@ -273,7 +273,7 @@ public async Task<IStorageHistory> DeleteItemsAsync(IList<IStorageItemWithPath>
273
273
var recycledSources = deleteResult . Items . Where ( x => x . Succeeded && x . Destination != null && x . Source != x . Destination ) ;
274
274
if ( recycledSources . Any ( ) )
275
275
{
276
- var sourceMatch = await recycledSources . Select ( x => source . SingleOrDefault ( s => s . Path == x . Source ) ) . Where ( x => x != null ) . ToListAsync ( ) ;
276
+ var sourceMatch = await recycledSources . Select ( x => source . DistinctBy ( x => x . Path ) . SingleOrDefault ( s => s . Path == x . Source ) ) . Where ( x => x != null ) . ToListAsync ( ) ;
277
277
return new StorageHistory ( FileOperationType . Recycle ,
278
278
sourceMatch ,
279
279
await recycledSources . Zip ( sourceMatch , ( rSrc , oSrc ) => new { rSrc , oSrc } )
@@ -287,7 +287,7 @@ public async Task<IStorageHistory> DeleteItemsAsync(IList<IStorageItemWithPath>
287
287
var failedSources = deleteResult . Items
288
288
. Where ( x => ! x . Succeeded && x . HResult != HResult . COPYENGINE_E_USER_CANCELLED && x . HResult != HResult . COPYENGINE_E_RECYCLE_BIN_NOT_FOUND ) ;
289
289
return await filesystemOperations . DeleteItemsAsync (
290
- await failedSources . Select ( x => source . SingleOrDefault ( s => s . Path == x . Source ) ) . Where ( x => x != null ) . ToListAsync ( ) , progress , errorCode , permanently , cancellationToken ) ;
290
+ await failedSources . Select ( x => source . DistinctBy ( x => x . Path ) . SingleOrDefault ( s => s . Path == x . Source ) ) . Where ( x => x != null ) . ToListAsync ( ) , progress , errorCode , permanently , cancellationToken ) ;
291
291
}
292
292
}
293
293
0 commit comments