From 408373de62711fe9fe0710bf8b5321e5f58cfc0c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 04:40:59 +0000 Subject: [PATCH 1/2] Initial plan From 21709e807305b723cd1377dbdd42895cd0464b99 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 04:45:32 +0000 Subject: [PATCH 2/2] Fix DialogJump UriFormatException for root directories Replace new Uri() with Uri.TryCreate() to handle malformed file: URIs gracefully. When file: prefix is present but URI parsing fails (e.g., "file:C:" without trailing slash), the code now strips the prefix and uses the path directly instead of throwing an exception. Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com> --- .../DialogJump/DialogJump.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs b/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs index 9035a541d29..3941bc114fc 100644 --- a/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs +++ b/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs @@ -828,9 +828,25 @@ private static bool CheckPath(string path, out bool file) return true; } // file: URI paths - var localPath = path.StartsWith("file:", StringComparison.OrdinalIgnoreCase) - ? new Uri(path).LocalPath - : path; + string localPath; + if (path.StartsWith("file:", StringComparison.OrdinalIgnoreCase)) + { + // Try to create a URI from the path + if (Uri.TryCreate(path, UriKind.Absolute, out var uri)) + { + localPath = uri.LocalPath; + } + else + { + // If URI creation fails, treat it as a regular path + // by removing the "file:" prefix + localPath = path.Substring(5); + } + } + else + { + localPath = path; + } // Is folder? var isFolder = Directory.Exists(localPath); // Is file?