diff --git a/src/Files.App/Utils/Git/GitHelpers.cs b/src/Files.App/Utils/Git/GitHelpers.cs index d41357f90495..befa53cf1780 100644 --- a/src/Files.App/Utils/Git/GitHelpers.cs +++ b/src/Files.App/Utils/Git/GitHelpers.cs @@ -870,10 +870,11 @@ public static (string RepoUrl, string RepoName) GetRepoInfo(string url) if (!match.Success) return (string.Empty, string.Empty); + string platform = match.Groups["domain"].Value; string userOrOrg = match.Groups["user"].Value; string repoName = match.Groups["repo"].Value; - string repoUrl = $"https://github.com/{userOrOrg}/{repoName}"; + string repoUrl = $"https://{platform}.com/{userOrOrg}/{repoName}"; return (repoUrl, repoName); } @@ -943,7 +944,7 @@ public static async Task CloneRepoAsync(string repoUrl, string repoName, string ReturnResult.Failed); } - [GeneratedRegex(@"^(?:https?:\/\/)?(?:www\.)?github\.com\/(?[^\/]+)\/(?[^\/]+?)(?=\.git|\/|$)(?:\.git)?(?:\/)?", RegexOptions.IgnoreCase)] + [GeneratedRegex(@"^(?:https?:\/\/)?(?:www\.)?(?github|gitlab)\.com\/(?[^\/]+)\/(?[^\/]+?)(?=\.git|\/|$)(?:\.git)?(?:\/)?", RegexOptions.IgnoreCase)] private static partial Regex GitHubRepositoryRegex(); } }