From e64a5e3b0f9d8ebfdc1158b8d3486323e47c3d81 Mon Sep 17 00:00:00 2001 From: affederaffe <68356204+affederaffe@users.noreply.github.com> Date: Mon, 5 Sep 2022 20:35:13 +0200 Subject: [PATCH] Fix DBusSystemDialog when path contains spaces --- src/Avalonia.FreeDesktop/DBusSystemDialog.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.FreeDesktop/DBusSystemDialog.cs b/src/Avalonia.FreeDesktop/DBusSystemDialog.cs index 7974069184..8597f3922a 100644 --- a/src/Avalonia.FreeDesktop/DBusSystemDialog.cs +++ b/src/Avalonia.FreeDesktop/DBusSystemDialog.cs @@ -72,7 +72,7 @@ namespace Avalonia.FreeDesktop using var disposable = await request.WatchResponseAsync(x => tsc.SetResult(x.results["uris"] as string[]), tsc.SetException); var uris = await tsc.Task ?? Array.Empty(); - return uris.Select(path => new BclStorageFile(new FileInfo(new Uri(path).AbsolutePath))).ToList(); + return uris.Select(path => new BclStorageFile(new FileInfo(new Uri(path).LocalPath))).ToList(); } public override async Task SaveFilePickerAsync(FilePickerSaveOptions options) @@ -96,7 +96,7 @@ namespace Avalonia.FreeDesktop var tsc = new TaskCompletionSource(); using var disposable = await request.WatchResponseAsync(x => tsc.SetResult(x.results["uris"] as string[]), tsc.SetException); var uris = await tsc.Task; - var path = uris?.FirstOrDefault() is { } filePath ? new Uri(filePath).AbsolutePath : null; + var path = uris?.FirstOrDefault() is { } filePath ? new Uri(filePath).LocalPath : null; if (path is null) { @@ -126,7 +126,7 @@ namespace Avalonia.FreeDesktop var uris = await tsc.Task ?? Array.Empty(); return uris - .Select(path => new Uri(path).AbsolutePath) + .Select(path => new Uri(path).LocalPath) // WSL2 freedesktop allows to select files as well in directory picker, filter it out. .Where(Directory.Exists) .Select(path => new BclStorageFolder(new DirectoryInfo(path))).ToList();