prevent stylesheet resources from being duplicated

This commit is contained in:
sbwalker 2025-03-21 17:34:07 -04:00
parent 2dd1d7e926
commit 2eac9c3795
3 changed files with 11 additions and 2 deletions

View File

@ -623,7 +623,7 @@
}
// ensure resource does not exist already
if (!pageresources.Exists(item => item.Url.ToLower() == resource.Url.ToLower()))
if (!pageresources.Exists(item => Utilities.GetUrlPath(item.Url).ToLower() == Utilities.GetUrlPath(resource.Url).ToLower()))
{
pageresources.Add(resource.Clone(level, name, fingerprint));
}

View File

@ -764,7 +764,7 @@
}
// ensure resource does not exist already
if (!pageresources.Exists(item => item.Url.ToLower() == resource.Url.ToLower()))
if (!pageresources.Exists(item => Utilities.GetUrlPath(item.Url).ToLower() == Utilities.GetUrlPath(resource.Url).ToLower()))
{
pageresources.Add(resource.Clone(level, name, fingerprint));
}

View File

@ -491,6 +491,15 @@ namespace Oqtane.Shared
return querystring;
}
public static string GetUrlPath(string url)
{
if (url.Contains("?"))
{
url = url.Substring(0, url.IndexOf("?"));
}
return url;
}
public static string LogMessage(object @class, string message)
{
return $"[{@class.GetType()}] {message}";