Skip to content

Commit c836ec6

Browse files
committed
Fix: Fixed an issue where opening Recycle Bin folders in a new window caused 'Drive unplugged NotAFolder' error
1 parent 1c18291 commit c836ec6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Files.App/Actions/Navigation/OpenInNewWindow/BaseOpenInNewWindowAction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ internal abstract class BaseOpenInNewWindowAction : ObservableObject, IAction
1111
protected IContentPageContext ContentPageContext { get; } = Ioc.Default.GetRequiredService<IContentPageContext>();
1212
protected IHomePageContext HomePageContext { get; } = Ioc.Default.GetRequiredService<IHomePageContext>();
1313
protected ISidebarContext SidebarContext { get; } = Ioc.Default.GetRequiredService<ISidebarContext>();
14+
protected IStorageTrashBinService StorageTrashBinService { get; } = Ioc.Default.GetRequiredService<IStorageTrashBinService>();
1415

1516
public string Label
1617
=> Strings.OpenInNewWindow.GetLocalizedResource();
@@ -49,6 +50,9 @@ public virtual async Task ExecuteAsync(object? parameter = null)
4950
foreach (ListedItem listedItem in items)
5051
{
5152
var selectedItemPath = (listedItem as IShortcutItem)?.TargetPath ?? listedItem.ItemPath;
53+
if (StorageTrashBinService.IsUnderTrashBin(selectedItemPath))
54+
selectedItemPath = Uri.EscapeDataString(Constants.UserEnvironmentPaths.RecycleBinPath);
55+
5256
var folderUri = new Uri($"files-dev:?folder={@selectedItemPath}");
5357

5458
await Launcher.LaunchUriAsync(folderUri);

0 commit comments

Comments
 (0)