From 7d099ff8e4bf0946f1f00235b3c3755e21ae7ea5 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Thu, 21 Nov 2024 16:31:05 -0600 Subject: [PATCH] Handle raw GitHub URLs containing refs/heads/ --- Netkan/Sources/Github/GithubApi.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Netkan/Sources/Github/GithubApi.cs b/Netkan/Sources/Github/GithubApi.cs index c9d1b21e8..1be237733 100644 --- a/Netkan/Sources/Github/GithubApi.cs +++ b/Netkan/Sources/Github/GithubApi.cs @@ -40,7 +40,7 @@ internal sealed class GithubApi : IGithubApi // https://raw.githubusercontent.com//// private static readonly Regex githubUserContentUrlRegex = - new Regex(@"^/(?[^/]+)/(?[^/]+)/(?[^/]+)/(?.+)$", + new Regex(@"^/(?[^/]+)/(?[^/]+)/(refs/heads/)?(?[^/]+)/(?.+)$", RegexOptions.Compiled); public GithubApi(IHttpService http, string? oauthToken = null) @@ -115,7 +115,8 @@ public List getOrgMembers(GithubUser organization) out string? ghBranch, out string? ghPath)) { - Log.Info("Found GitHub URL, retrieving with API"); + Log.InfoFormat("Found GitHub URL, retrieving with API: {0} {1} {2} {3}", + ghOwner, ghRepo, ghBranch, ghPath); return Call( $"repos/{ghOwner}/{ghRepo}/contents/{ghPath}?ref={ghBranch}", rawMediaType);