Skip to content

Commit 80e367e

Browse files
Jack251970jjw24
authored andcommitted
Fix DialogJump UriFormatException when navigating to root directories (#4052)
1 parent 1941794 commit 80e367e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Flow.Launcher.Infrastructure/DialogJump/DialogJump.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,25 @@ private static bool CheckPath(string path, out bool file)
832832
return true;
833833
}
834834
// file: URI paths
835-
var localPath = path.StartsWith("file:", StringComparison.OrdinalIgnoreCase)
836-
? new Uri(path).LocalPath
837-
: path;
835+
string localPath;
836+
if (path.StartsWith("file:", StringComparison.OrdinalIgnoreCase))
837+
{
838+
// Try to create a URI from the path
839+
if (Uri.TryCreate(path, UriKind.Absolute, out var uri))
840+
{
841+
localPath = uri.LocalPath;
842+
}
843+
else
844+
{
845+
// If URI creation fails, treat it as a regular path
846+
// by removing the "file:" prefix
847+
localPath = path.Substring(5);
848+
}
849+
}
850+
else
851+
{
852+
localPath = path;
853+
}
838854
// Is folder?
839855
var isFolder = Directory.Exists(localPath);
840856
// Is file?

0 commit comments

Comments
 (0)