Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40aedb9

Browse files
Allow fall through. Touch #277
1 parent e3699bd commit 40aedb9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,27 @@ private async Task ProcessImageAsync(HttpContext context)
523523
bool gamma = fixGamma != null && fixGamma.Value;
524524
using (ImageFactory imageFactory = new ImageFactory(exif, gamma))
525525
{
526-
byte[] imageBuffer = await currentService.GetImage(resourcePath);
526+
byte[] imageBuffer = null;
527527
string mimeType;
528528

529+
try
530+
{
531+
imageBuffer = await currentService.GetImage(resourcePath);
532+
}
533+
catch (HttpException ex)
534+
{
535+
// We want 404's to be handled by IIS so that other handlers/modules can still run.
536+
if (ex.GetHttpCode() == (int)HttpStatusCode.NotFound)
537+
{
538+
return;
539+
}
540+
}
541+
542+
if (imageBuffer == null)
543+
{
544+
return;
545+
}
546+
529547
using (MemoryStream inStream = new MemoryStream(imageBuffer))
530548
{
531549
// Process the Image

0 commit comments

Comments
 (0)