From 11b0b54c66fb7191e2d9732b59a031a1e4d6b5d5 Mon Sep 17 00:00:00 2001 From: Marco Gavelli Date: Fri, 13 Aug 2021 19:35:09 +0200 Subject: [PATCH] Code cleanup 2 --- .../Helpers/FilesystemHelpers.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Files/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs b/Files/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs index 4406ed48f396a..1bbe79c4a31df 100644 --- a/Files/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs +++ b/Files/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs @@ -657,17 +657,19 @@ public async Task CopyItemAsync(IStorageItemWithPath source, strin public async Task RecycleItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory) { + if (!HasDraggedStorageItems(packageView)) + { + // Happens if you copy some text and then you Ctrl+V in Files + return ReturnResult.BadArgumentException; + } + var (handledByFtp, source) = await GetDraggedStorageItems(packageView); + if (handledByFtp) { // Not supported return ReturnResult.Failed; } - if (!source.Any()) - { - // Happens if you copy some text and then you Ctrl+V in Files - return ReturnResult.BadArgumentException; - } ReturnResult returnStatus = ReturnResult.InProgress; @@ -680,6 +682,7 @@ public async Task RecycleItemsFromClipboard(DataPackageView packag public async Task CopyItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory) { var (handledByFtp, source) = await GetDraggedStorageItems(packageView); + if (handledByFtp) { var connection = await ServiceConnection; @@ -899,17 +902,19 @@ public async Task MoveItemAsync(IStorageItemWithPath source, strin public async Task MoveItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory) { + if (!HasDraggedStorageItems(packageView)) + { + // Happens if you copy some text and then you Ctrl+V in Files + return ReturnResult.BadArgumentException; + } + var (handledByFtp, source) = await GetDraggedStorageItems(packageView); + if (handledByFtp) { // Not supported return ReturnResult.Failed; } - if (!source.Any()) - { - // Happens if you copy some text and then you Ctrl+V in Files - return ReturnResult.BadArgumentException; - } ReturnResult returnStatus = ReturnResult.InProgress;