fix: check for multiple URL patterns for both template & system URLS

This commit is contained in:
Andrew Welker
2025-11-18 12:30:54 -06:00
parent 6d64fffc50
commit c06b57a5f9

View File

@@ -36,21 +36,29 @@ namespace PepperDash.Essentials.Core.Config
{ {
get get
{ {
if (string.IsNullOrEmpty(SystemUrl)) string uuid;
return "missing url";
if (SystemUrl.Contains("#")) if (string.IsNullOrEmpty(SystemUrl))
{
uuid = "missing url";
}
else if (SystemUrl.Contains("#"))
{ {
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*"); var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
string uuid = result.Groups[1].Value; uuid = result.Groups[1].Value;
return uuid; }
else if (SystemUrl.Contains("detail"))
{
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/detail\/(.*)\/.*");
uuid = result.Groups[1].Value;
} }
else else
{ {
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/detail\/(.*)\/.*"); var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*");
string uuid = result.Groups[1].Value; uuid = result.Groups[1].Value;
return uuid;
} }
return uuid;
} }
} }
@@ -62,21 +70,29 @@ namespace PepperDash.Essentials.Core.Config
{ {
get get
{ {
if (string.IsNullOrEmpty(TemplateUrl)) string uuid;
return "missing template url";
if (TemplateUrl.Contains("#")) if (string.IsNullOrEmpty(TemplateUrl))
{
uuid = "missing template url";
}
else if (TemplateUrl.Contains("#"))
{ {
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*"); var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
string uuid = result.Groups[1].Value; uuid = result.Groups[1].Value;
return uuid; }
else if (TemplateUrl.Contains("detail"))
{
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/detail\/(.*)\/system-template-versions\/detail\/(.*)\/.*");
uuid = result.Groups[2].Value;
} }
else else
{ {
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/detail\/(.*)\/system-template-versions\/detail\/(.*)\/.*"); var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*");
string uuid = result.Groups[2].Value; uuid = result.Groups[2].Value;
return uuid;
} }
return uuid;
} }
} }