Skip to content

Commit 5e05c00

Browse files
committed
refactor: simplfy the regex to check remote's URL with HTTP/HTTPS/GIT protocol
Signed-off-by: leo <[email protected]>
1 parent 598ba6d commit 5e05c00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Models/Remote.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace SourceGit.Models
66
{
77
public partial class Remote
88
{
9-
[GeneratedRegex(@"^https?://([-a-zA-Z0-9:%._\+~#=]+@)?[-a-zA-Z0-9:%._\+~#=]{1,256}(\.[a-zA-Z0-9()]{1,6})?(:[0-9]{1,5})?\b(/[-a-zA-Z0-9()@:%_\+.~#?&=]+)+(\.git)?$")]
9+
[GeneratedRegex(@"^https?://[^/]+/.+[^/\.]$")]
1010
private static partial Regex REG_HTTPS();
11-
[GeneratedRegex(@"^git://([-a-zA-Z0-9:%._\+~#=]+@)?[-a-zA-Z0-9:%._\+~#=]{1,256}(\.[a-zA-Z0-9()]{1,6})?(:[0-9]{1,5})?\b(/[-a-zA-Z0-9()@:%_\+.~#?&=]+)+(\.git)?$")]
11+
[GeneratedRegex(@"^git://[^/]+/.+[^/\.]$")]
1212
private static partial Regex REG_GIT();
1313
[GeneratedRegex(@"^[\w\-]+@[\w\.\-]+(\:[0-9]+)?:([a-zA-z0-9~%][\w\-\./~%]*)?[a-zA-Z0-9](\.git)?$")]
1414
private static partial Regex REG_SSH1();

0 commit comments

Comments
 (0)