Skip to content

Commit d3b2e64

Browse files
committed
Updating to have the file extension as a parameter.
1 parent 92f8b5d commit d3b2e64

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

eFormAPI/eFormAPI/Controllers/TemplateFilesController.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ public HttpResponseMessage Csv(int id)
4545
}
4646

4747
[HttpGet]
48-
[Route("api/template-files/get-image/{fileName}.png")]
49-
[Route("api/template-files/get-image/{fileName}.jpg")]
50-
[Route("api/template-files/get-image/{fileName}.jpeg")]
51-
public HttpResponseMessage GetImage(string fileName, string noCache = "noCache")
48+
[Route("api/template-files/get-image/{fileName}.{ext}")]
49+
public HttpResponseMessage GetImage(string fileName, string ext, string noCache = "noCache")
5250
{
53-
var filePath = HttpContext.Current.Server.MapPath($"~/output/datafolder/picture/{fileName}");
51+
var filePath = HttpContext.Current.Server.MapPath($"~/output/datafolder/picture/{fileName}.{ext}");
5452
if (!File.Exists(filePath))
5553
{
5654
return new HttpResponseMessage(HttpStatusCode.NotFound);

0 commit comments

Comments
 (0)