refactor: rewrite Remote.IsValidURL (#1339)

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

View file

@ -50,19 +50,7 @@ namespace SourceGit.Models
return true;
}
var localPath = url;
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);
return url.StartsWith("file://", StringComparison.Ordinal) || Directory.Exists(url);
}
public bool TryGetVisitURL(out string url)