From 3690042d2c5438854a82f6fe87e94f515712796e Mon Sep 17 00:00:00 2001 From: Jack Ye Date: Wed, 15 Oct 2025 17:12:51 +0800 Subject: [PATCH] Fix DialogJump UriFormatException when navigating to root directories (#4052) --- .../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 9035a541d..3941bc114 100644 --- a/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs +++ b/Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs @@ -828,9 +828,25 @@ namespace Flow.Launcher.Infrastructure.DialogJump 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?