add caching support for ImageUrl

This commit is contained in:
sbwalker
2025-03-18 14:29:09 -04:00
parent fa32937045
commit b4ce6bbb42
2 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,7 @@ using System.IO.Compression;
using Oqtane.Services;
using Microsoft.Extensions.Primitives;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.Net.Http.Headers;
// ReSharper disable StringIndexOfIsCultureSpecific.1
@ -735,6 +736,10 @@ namespace Oqtane.Controllers
}
if (!string.IsNullOrEmpty(imagepath))
{
if (!string.IsNullOrEmpty(file.Folder.CacheControl))
{
HttpContext.Response.Headers.Append(HeaderNames.CacheControl, value: file.Folder.CacheControl);
}
return PhysicalFile(imagepath, file.GetMimeType());
}
else