From 2c49fb93218059c1128feea866bbd84cf50ef93d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 12 Nov 2025 16:58:23 -0600 Subject: [PATCH] fix: parse current Portal URLS for system and template UUIDs correctly --- .../Config/Essentials/EssentialsConfig.cs | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs index 7108762b..b08f458c 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs @@ -11,11 +11,11 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Config { - /// - /// Loads the ConfigObject from the file - /// - public class EssentialsConfig : BasicConfig - { + /// + /// Loads the ConfigObject from the file + /// + public class EssentialsConfig : BasicConfig + { /// /// Gets or sets the SystemUrl /// @@ -32,21 +32,22 @@ namespace PepperDash.Essentials.Core.Config /// Gets the SystemUuid extracted from the SystemUrl /// [JsonProperty("systemUuid")] - public string SystemUuid + public string SystemUuid { get { - if (string.IsNullOrEmpty(SystemUrl)) - return "missing url"; + if (string.IsNullOrEmpty(SystemUrl)) + return "missing url"; - if (SystemUrl.Contains("#")) - { - var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*"); - string uuid = result.Groups[1].Value; - return uuid; - } else - { - var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*"); + if (SystemUrl.Contains("#")) + { + var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*"); + string uuid = result.Groups[1].Value; + return uuid; + } + else + { + var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/detail\/(.*)\/.*"); string uuid = result.Groups[1].Value; return uuid; } @@ -57,21 +58,22 @@ namespace PepperDash.Essentials.Core.Config /// Gets the TemplateUuid extracted from the TemplateUrl /// [JsonProperty("templateUuid")] - public string TemplateUuid + public string TemplateUuid { get { - if (string.IsNullOrEmpty(TemplateUrl)) - return "missing template url"; + if (string.IsNullOrEmpty(TemplateUrl)) + return "missing template url"; - if (TemplateUrl.Contains("#")) - { - var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*"); - string uuid = result.Groups[1].Value; - return uuid; - } else - { - var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*"); + if (TemplateUrl.Contains("#")) + { + var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*"); + string uuid = result.Groups[1].Value; + return uuid; + } + else + { + var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/detail\/(.*)\/system-template-versions\/detail\/(.*)\/.*"); string uuid = result.Groups[2].Value; return uuid; } @@ -97,7 +99,7 @@ namespace PepperDash.Essentials.Core.Config { Rooms = new List(); } - } + } /// /// Represents version data for Essentials and its packages @@ -147,7 +149,7 @@ namespace PepperDash.Essentials.Core.Config /// Represents a SystemTemplateConfigs /// public class SystemTemplateConfigs - { + { /// /// Gets or sets the System /// @@ -157,5 +159,5 @@ namespace PepperDash.Essentials.Core.Config /// Gets or sets the Template /// public EssentialsConfig Template { get; set; } - } + } } \ No newline at end of file