fix #5005 - adds versioning (ie. fingerprinting) for static assets - core, modules, and themes.

This commit is contained in:
sbwalker
2025-01-27 16:34:47 -05:00
parent 7a9c637e03
commit 153a689bdb
15 changed files with 145 additions and 60 deletions

View File

@ -575,7 +575,6 @@ namespace Oqtane.Shared
}
else if (expiryDate.HasValue)
{
// Include equality check here
return currentUtcTime <= expiryDate.Value;
}
else
@ -586,32 +585,40 @@ namespace Oqtane.Shared
public static bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
{
// Treat DateTime.MinValue as null
effectiveDate ??= DateTime.MinValue;
expiryDate ??= DateTime.MinValue;
// Check if both effectiveDate and expiryDate have values
if (effectiveDate != DateTime.MinValue && expiryDate != DateTime.MinValue)
{
return effectiveDate <= expiryDate;
}
// Check if only effectiveDate has a value
else if (effectiveDate != DateTime.MinValue)
{
return true;
}
// Check if only expiryDate has a value
else if (expiryDate != DateTime.MinValue)
{
return true;
}
// If neither effectiveDate nor expiryDate has a value, consider the page/module visible
else
{
return true;
}
}
public static string GenerateSimpleHash(string text)
{
unchecked // prevent overflow exception
{
int hash = 23;
foreach (char c in text)
{
hash = hash * 31 + c;
}
return hash.ToString("X8");
}
}
[Obsolete("ContentUrl(Alias alias, int fileId) is deprecated. Use FileUrl(Alias alias, int fileId) instead.", false)]
public static string ContentUrl(Alias alias, int fileId)
{