From c63284cb371024c8e879d4ebdbad64b0659a25df Mon Sep 17 00:00:00 2001 From: koko Date: Sun, 1 Oct 2023 08:11:33 -0400 Subject: [PATCH] Add param to include HTTPS prefix in DetermineRemoteUrl method --- .../Pages/Layouts/BaseLayout.cshtml | 2 +- ProjectLighthouse/Helpers/VersionHelper.cs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml index 78d36de4..a755562c 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml @@ -192,7 +192,7 @@
@{ - string? remoteUrl = VersionHelper.DetermineRemoteUrl(); + string? remoteUrl = VersionHelper.DetermineRemoteUrl(false); } @Model.Translate(BaseLayoutStrings.GeneratedBy, VersionHelper.FullVersion) diff --git a/ProjectLighthouse/Helpers/VersionHelper.cs b/ProjectLighthouse/Helpers/VersionHelper.cs index 3262437d..82222e09 100644 --- a/ProjectLighthouse/Helpers/VersionHelper.cs +++ b/ProjectLighthouse/Helpers/VersionHelper.cs @@ -52,7 +52,8 @@ public static class VersionHelper /// Determines the URL of the git remote. This doesn't return a complete URL and it's only really used for the /// "Source Code" hyperlink in the BaseLayout. Use this with caution. /// - public static string? DetermineRemoteUrl() + /// Include the "https://" prefix in the returned URL. + public static string? DetermineRemoteUrl(bool includePrefix = true) { string? remoteUnparsedUrl = null; string? remoteParsedUrl = null; @@ -66,7 +67,9 @@ public static class VersionHelper } else if (remoteUnparsedUrl.Contains("https://")) { - remoteParsedUrl = remoteUnparsedUrl.Replace("https://", "").Split(".git").FirstOrDefault(); + remoteParsedUrl = includePrefix + ? remoteUnparsedUrl.Split(".git").FirstOrDefault() + : remoteUnparsedUrl.Replace("https://", "").Split(".git").FirstOrDefault(); } return remoteParsedUrl;