Update file download (add file name) + update max audio and other file size

This commit is contained in:
Fransolet Thomas 2023-03-10 19:46:37 +01:00
parent f5921180cf
commit eb50590684

View File

@ -194,11 +194,17 @@ namespace ManagerService.Controllers
if (resource.Type == ResourceType.Image) if (resource.Type == ResourceType.Image)
{ {
return new FileContentResult(file, "image/png"); return new FileContentResult(file, "image/png")
{
FileDownloadName = resource.Label + ".png"
};
} }
if (resource.Type == ResourceType.Video || resource.Type == ResourceType.Audio) if (resource.Type == ResourceType.Video || resource.Type == ResourceType.Audio)
{ {
return new FileContentResult(file, "application/octet-stream"); return new FileContentResult(file, "application/octet-stream")
{
FileDownloadName = resource.Type == ResourceType.Audio ? resource.Label + ".mp3" : resource.Label + ".mp4",
};
} }
return new FileContentResult(file, "image/png"); return new FileContentResult(file, "image/png");
@ -236,7 +242,7 @@ namespace ManagerService.Controllers
{ {
var stringResult = ""; var stringResult = "";
double fileSizeibMbs = (double) ((double)file.Length) / (1024*1024); double fileSizeibMbs = (double) ((double)file.Length) / (1024*1024);
if (fileSizeibMbs <= 4.01 || resourceType == ResourceType.Image) if (fileSizeibMbs <= 1.5 || resourceType == ResourceType.Image)
{ {
using (var ms = new MemoryStream()) using (var ms = new MemoryStream())
{ {