[FA-misc] Fixes file caching
All checks were successful
CI / build-backend (pull_request) Successful in 1m4s
CI / build-frontend (pull_request) Successful in 41s

This commit is contained in:
gamer147
2025-12-10 16:09:41 -05:00
parent 4fb34bdef7
commit 6fd76f6787

View File

@@ -36,7 +36,15 @@ namespace FictionArchive.Service.FileService.Controllers
Key = decodedPath Key = decodedPath
}); });
return new FileStreamResult(s3Response.ResponseStream, s3Response.Headers.ContentType); Response.Headers.CacheControl = "public, max-age=604800"; // 7 days
Response.Headers.LastModified = s3Response.LastModified?.ToString("R");
if (!string.IsNullOrEmpty(s3Response.ETag))
{
Response.Headers.ETag = s3Response.ETag;
}
return File(s3Response.ResponseStream, s3Response.Headers.ContentType);
} }
catch (AmazonS3Exception e) catch (AmazonS3Exception e)
{ {