From 3232e6f313275de43842100f9538f4e587ed7b3d Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 21 May 2025 14:18:06 +0800 Subject: [PATCH] fix: on Windows, the correct file protocol url format is `file:///:/path/to/file_or_dir` (#1339) Signed-off-by: leo --- src/Models/Remote.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Models/Remote.cs b/src/Models/Remote.cs index de2efc10..162c5aca 100644 --- a/src/Models/Remote.cs +++ b/src/Models/Remote.cs @@ -51,8 +51,16 @@ namespace SourceGit.Models } var localPath = url; - if (url.StartsWith("file://", StringComparison.Ordinal)) - localPath = url.Substring(7); + if (OperatingSystem.IsWindows()) + { + if (url.StartsWith("file:///", StringComparison.Ordinal)) + localPath = url.Substring(8); + } + else + { + if (url.StartsWith("file://", StringComparison.Ordinal)) + localPath = url.Substring(7); + } return Directory.Exists(localPath); }