From 59d515b91917aec424b1062b48db484b4b4052c2 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 16 Dec 2021 18:49:17 +0330 Subject: [PATCH] #262 returning images MIME type as image.ContentType instead of "image/jpeg" --- RMuseum/Controllers/ImageController.cs | 2 +- RSecurityBackend/Controllers/RImageControllerBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RMuseum/Controllers/ImageController.cs b/RMuseum/Controllers/ImageController.cs index 26ddd2e3..0e100837 100644 --- a/RMuseum/Controllers/ImageController.cs +++ b/RMuseum/Controllers/ImageController.cs @@ -56,7 +56,7 @@ namespace RMuseum.Controllers return BadRequest(imgPath.ExceptionString); - return new FileStreamResult(new FileStream(imgPath.Result, FileMode.Open, FileAccess.Read), "image/jpeg"); + return new FileStreamResult(new FileStream(imgPath.Result, FileMode.Open, FileAccess.Read), img.Result.ContentType); } diff --git a/RSecurityBackend/Controllers/RImageControllerBase.cs b/RSecurityBackend/Controllers/RImageControllerBase.cs index 270154f5..89775b90 100644 --- a/RSecurityBackend/Controllers/RImageControllerBase.cs +++ b/RSecurityBackend/Controllers/RImageControllerBase.cs @@ -69,7 +69,7 @@ namespace RSecurityBackend.Controllers return StatusCode(StatusCodes.Status304NotModified); } - return new FileStreamResult(new FileStream(imgPath, FileMode.Open, FileAccess.Read), "image/jpeg"); + return new FileStreamResult(new FileStream(imgPath, FileMode.Open, FileAccess.Read), img.ContentType); }