Imageprocessor: HTTP status code 304 Not Modified not correctly passed through in AzureBlobCache

Created on 20 Jul 2020  路  4Comments  路  Source: JimBobSquarePants/ImageProcessor

Hi James,

Since we've updated our packages in our project to the latest versions of ImageProcessor, we're experiencing an issue with the 304 Not Modified header. When we first load our image (without cache), everything works perfectly. But the issue arises when we reload the image again in the browser, then we get a blank screen (in Chrome).

I just dived a little into your package. And I found that the ex.InnerException returns null and therefore is304 always stays false in this code-block:
https://github.com/JimBobSquarePants/ImageProcessor/blob/8032986b9d8826b00171bc43ce7f86cb187e677a/src/ImageProcessor.Web.Plugins.AzureBlobCache/AzureBlobCache.cs#L351-L373

System Configuration

.NET Framework: 4.8
ImageProcessor: 2.9.0
ImageProcessor.Web: 4.12.1
ImageProcessor.Web.Config: 2.6.0
ImageProcessor.Web.Plugins.AzureBlobCache: 1.7.0

ImageProcessor Configuration

UseCachedContainerInUrl: false
StreamCachedImage: true

Thanks for the support in advance! We would really appreciate that! And stay healthy!

Regards!

bug up-for-grabs web

Most helpful comment

I can confirm it's now working correctly. Thank you @JimBobSquarePants and @ronaldbarendse for the quickly resolving this problem!

All 4 comments

I'm not completely familiar with Azure Blob Storage, but looking at the StorageException, the HTTP status code is probably stored in the RequestInformation.HttpStatusCode property (instead of the inner exception), see:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.storageexception.requestinformation?view=azure-dotnet#Microsoft_Azure_Storage_StorageException_RequestInformation.

@ronaldbarendse Yup, already started working on the fix. It's simple enough.

I can confirm it's now working correctly. Thank you @JimBobSquarePants and @ronaldbarendse for the quickly resolving this problem!

Was this page helpful?
0 / 5 - 0 ratings