Prerequisites
ImageSharp.Web version
4.0.1
Other Six Labors packages and versions
4.1.1
Environment (Operating system, version and so on)
win11
.NET version
net10
Description
The Middleware is checking the CacheLastWriteTime and SourceLastWriteTime.
I think it should also check if the Content Length differs.
// Or has the source image changed since the image was last cached?
if (cachedImage.ImageCacheMetadata.ContentLength == 0 // Fix for old cache without length property
|| cachedImage.ImageCacheMetadata.CacheLastWriteTimeUtc <= (DateTimeOffset.UtcNow - this.options.CacheMaxAge)
|| cachedImage.ImageCacheMetadata.SourceLastWriteTimeUtc != sourceImageMetadata.LastWriteTimeUtc)
vs
if (cachedImage.ImageCacheMetadata.ContentLength == 0 // Fix for old cache without length property
|| cachedImage.ImageCacheMetadata.ContentLength != sourceImageMetadata.ContentLength
|| cachedImage.ImageCacheMetadata.CacheLastWriteTimeUtc <= (DateTimeOffset.UtcNow - this.options.CacheMaxAge)
|| cachedImage.ImageCacheMetadata.SourceLastWriteTimeUtc != sourceImageMetadata.LastWriteTimeUtc)
Btw. I hit an edge case eith the SourceMetadataLru cache. When you load the image, replace it and instantly load it (all in 30 seconds) --> This will result in old sourceImageMetadata because of the Lifetime of 30 seconds for the SourceMetadataLru
Steps to Reproduce
--
Images
No response
Prerequisites
DEBUGandRELEASEmodeImageSharp.Web version
4.0.1
Other Six Labors packages and versions
4.1.1
Environment (Operating system, version and so on)
win11
.NET version
net10
Description
The Middleware is checking the CacheLastWriteTime and SourceLastWriteTime.
I think it should also check if the Content Length differs.
vs
Btw. I hit an edge case eith the SourceMetadataLru cache. When you load the image, replace it and instantly load it (all in 30 seconds) --> This will result in old sourceImageMetadata because of the Lifetime of 30 seconds for the SourceMetadataLru
Steps to Reproduce
--
Images
No response