mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-24 05:22:22 +00:00
31 lines
909 B
C#
31 lines
909 B
C#
using System.Threading.Tasks;
|
|
using MalwareMultiScan.Api.Services;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace MalwareMultiScan.Api.Controllers
|
|
{
|
|
[Route("download")]
|
|
public class DownloadController : Controller
|
|
{
|
|
private readonly ScanResultsService _scanResultsService;
|
|
|
|
public DownloadController(ScanResultsService scanResultsService)
|
|
{
|
|
_scanResultsService = scanResultsService;
|
|
}
|
|
|
|
[HttpGet("{id}")]
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
|
public async Task<IActionResult> Index(string id)
|
|
{
|
|
var fileStream = await _scanResultsService.ObtainFile(id);
|
|
|
|
if (fileStream == null)
|
|
return NotFound();
|
|
|
|
return File(fileStream, "application/octet-stream");
|
|
}
|
|
}
|
|
} |