fix<GitURL>: fix parse repository's SSH URL

This commit is contained in:
leo 2023-08-23 16:45:45 +08:00
parent dfc452b2a6
commit fc43edb6d2
2 changed files with 2 additions and 2 deletions

View file

@ -14,7 +14,7 @@ namespace SourceGit.Views {
/// </summary> /// </summary>
public partial class Clone : Controls.Window { public partial class Clone : Controls.Window {
private static readonly Regex[] SSH_PROTOCOAL = new Regex[] { private static readonly Regex[] SSH_PROTOCOAL = new Regex[] {
new Regex(@"[\w\-]+@[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"), new Regex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-]+/[\w\-]+\.git$"),
new Regex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"), new Regex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"),
}; };

View file

@ -7,7 +7,7 @@ namespace SourceGit.Views.Validations {
public class GitURL : ValidationRule { public class GitURL : ValidationRule {
private static readonly Regex[] VALID_FORMATS = new Regex[] { private static readonly Regex[] VALID_FORMATS = new Regex[] {
new Regex(@"^http[s]?://[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"), new Regex(@"^http[s]?://[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"),
new Regex(@"[\w\-]+@[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"), new Regex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:[\w\-]+/[\w\-]+\.git$"),
new Regex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"), new Regex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-]+\.git$"),
}; };