File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/ImageProcessor.Web/HttpModules Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -523,9 +523,27 @@ private async Task ProcessImageAsync(HttpContext context)
523
523
bool gamma = fixGamma != null && fixGamma . Value ;
524
524
using ( ImageFactory imageFactory = new ImageFactory ( exif , gamma ) )
525
525
{
526
- byte [ ] imageBuffer = await currentService . GetImage ( resourcePath ) ;
526
+ byte [ ] imageBuffer = null ;
527
527
string mimeType ;
528
528
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
+
529
547
using ( MemoryStream inStream = new MemoryStream ( imageBuffer ) )
530
548
{
531
549
// Process the Image
You can’t perform that action at this time.
0 commit comments