diff --git a/API/Controllers/MangaController.cs b/API/Controllers/MangaController.cs index 3788a98..7c5d7ba 100644 --- a/API/Controllers/MangaController.cs +++ b/API/Controllers/MangaController.cs @@ -226,8 +226,11 @@ public class MangaController(MangaContext context) : Controller } DateTime lastModified = data.fileInfo.LastWriteTime; + EntityTagHeaderValue entityTagHeaderValue = EntityTagHeaderValue.Parse($"\"{lastModified.Ticks}\""); + if(HttpContext.Request.Headers.ETag.Equals(entityTagHeaderValue.Tag.Value)) + return TypedResults.StatusCode(Status304NotModified); HttpContext.Response.Headers.CacheControl = "public"; - return TypedResults.Bytes(data.stream.ToArray(), "image/jpeg", lastModified: new DateTimeOffset(lastModified), entityTag: EntityTagHeaderValue.Parse($"\"{lastModified.Ticks}\"")); + return TypedResults.Bytes(data.stream.ToArray(), "image/jpeg", lastModified: new DateTimeOffset(lastModified), entityTag: entityTagHeaderValue); } public enum CoverSize { Original, Large, Medium, Small }