Fixing Spritesheet bug...i fixed the wrong edit...

This commit is contained in:
dingo
2025-12-29 12:51:40 -05:00
parent 1952afcc55
commit e558930280
@@ -28,7 +28,8 @@ public class EditModel : AdminPageModel
public async Task OnGetAsync(int? id)
{
CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
//CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
CdnImages = await _db.ClientAssets
.Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled)
.OrderBy(a => a.FilePath)
@@ -57,8 +58,9 @@ public class EditModel : AdminPageModel
public async Task<IActionResult> OnPostAsync()
{
CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
//CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com";
CdnBaseUrl = NormalizeCdnBaseUrl(_config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com");
try
{
if (Sheet.Id == 0)
@@ -223,4 +225,18 @@ public class EditModel : AdminPageModel
return RedirectToPage(new { id = copy.Id });
}
private static string NormalizeCdnBaseUrl(string? baseUrl)
{
baseUrl = string.IsNullOrWhiteSpace(baseUrl)
? "https://assets.aeternalisgames.com"
: baseUrl;
baseUrl = baseUrl.TrimEnd('/');
if (!baseUrl.EndsWith("/downloads", StringComparison.OrdinalIgnoreCase))
baseUrl += "/downloads";
return baseUrl;
}
}