forked from ddrilling/AsbCloudServer
CF2-8: Исправлено возвращение репорта из контроллера
This commit is contained in:
parent
31a33b243f
commit
4e28e24986
@ -78,10 +78,10 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wellId">id скважины</param>
|
/// <param name="wellId">id скважины</param>
|
||||||
/// <param name="reportName">имя запрашиваемого файла (отчета)</param>
|
/// <param name="reportName">имя запрашиваемого файла (отчета)</param>
|
||||||
/// <returns>файловый поток с отчетом</returns>
|
/// <returns>файл с отчетом</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("{wellId}/{reportName}")]
|
[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)
|
public IActionResult GetReport([FromRoute] int wellId, string reportName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -94,8 +94,8 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
if (!wellService.CheckWellOwnership((int)idCustomer, wellId))
|
if (!wellService.CheckWellOwnership((int)idCustomer, wellId))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
// TODO: словарь content typoв
|
// TODO: словарь content typoв
|
||||||
var a = Path.Combine(reportService.RootPath, $"{wellId}", reportName);
|
var relativePath = Path.Combine(reportService.RootPath, $"{wellId}", reportName);
|
||||||
return PhysicalFile(Path.Combine(reportService.RootPath, $"{wellId}", reportName), "application/pdf", reportName);
|
return PhysicalFile(Path.GetFullPath(relativePath), "application/pdf", reportName);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user