CF2-8: Исправлено возвращение репорта из контроллера

This commit is contained in:
KharchenkoVV 2021-06-09 17:19:06 +05:00
parent 31a33b243f
commit 4e28e24986

View File

@ -78,10 +78,10 @@ namespace AsbCloudWebApi.Controllers
/// </summary>
/// <param name="wellId">id скважины</param>
/// <param name="reportName">имя запрашиваемого файла (отчета)</param>
/// <returns>файловый поток с отчетом</returns>
/// <returns>файл с отчетом</returns>
[HttpGet]
[Route("{wellId}/{reportName}")]
[ProducesResponseType(typeof(FileStreamResult), (int)System.Net.HttpStatusCode.OK)]
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetReport([FromRoute] int wellId, string reportName)
{
try
@ -94,8 +94,8 @@ namespace AsbCloudWebApi.Controllers
if (!wellService.CheckWellOwnership((int)idCustomer, wellId))
return Forbid();
// TODO: словарь content typoв
var a = Path.Combine(reportService.RootPath, $"{wellId}", reportName);
return PhysicalFile(Path.Combine(reportService.RootPath, $"{wellId}", reportName), "application/pdf", reportName);
var relativePath = Path.Combine(reportService.RootPath, $"{wellId}", reportName);
return PhysicalFile(Path.GetFullPath(relativePath), "application/pdf", reportName);
}
catch (FileNotFoundException ex)
{