fix: on Windows, the correct file protocol url format is file:///<driver>:/path/to/file_or_dir (#1339)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-21 14:18:06 +08:00
parent 0a6b1faa65
commit 3232e6f313
No known key found for this signature in database

View file

@ -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);
}