From ff81eca6da576b2e6d68b85a2224daffea8c7765 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Sun, 31 Aug 2025 23:18:52 +0530 Subject: [PATCH 1/2] Feature: Add support for GitLab repository URLs Extended the repository URL regex to accept both github.com and gitlab.com --- src/Files.App/Utils/Git/GitHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Utils/Git/GitHelpers.cs b/src/Files.App/Utils/Git/GitHelpers.cs index d41357f90495..06a39fcb3831 100644 --- a/src/Files.App/Utils/Git/GitHelpers.cs +++ b/src/Files.App/Utils/Git/GitHelpers.cs @@ -943,7 +943,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(); } } From c1a1fe2c57fbf5543709551aed306b7b3fe1cfd9 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Mon, 1 Sep 2025 10:52:54 +0530 Subject: [PATCH 2/2] Fix: Add support for GitLab repository URLs --- src/Files.App/Utils/Git/GitHelpers.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Utils/Git/GitHelpers.cs b/src/Files.App/Utils/Git/GitHelpers.cs index 06a39fcb3831..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|gitlab)\.com\/(?[^\/]+)\/(?[^\/]+?)(?=\.git|\/|$)(?:\.git)?(?:\/)?", RegexOptions.IgnoreCase)] + [GeneratedRegex(@"^(?:https?:\/\/)?(?:www\.)?(?github|gitlab)\.com\/(?[^\/]+)\/(?[^\/]+?)(?=\.git|\/|$)(?:\.git)?(?:\/)?", RegexOptions.IgnoreCase)] private static partial Regex GitHubRepositoryRegex(); } }