2019-04-22 09:41:20 +02:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BTCPayServer.Storage.Services;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Storage
|
|
|
|
{
|
|
|
|
[Route("Storage")]
|
2019-05-24 08:44:23 +02:00
|
|
|
public class StorageController : Controller
|
2019-04-22 09:41:20 +02:00
|
|
|
{
|
|
|
|
private readonly FileService _FileService;
|
|
|
|
|
2021-01-06 15:51:13 +01:00
|
|
|
public StorageController(FileService fileService)
|
2019-04-22 09:41:20 +02:00
|
|
|
{
|
|
|
|
_FileService = fileService;
|
|
|
|
}
|
|
|
|
|
|
|
|
[HttpGet("{fileId}")]
|
|
|
|
public async Task<IActionResult> GetFile(string fileId)
|
|
|
|
{
|
2019-05-24 08:44:23 +02:00
|
|
|
var url = await _FileService.GetFileUrl(Request.GetAbsoluteRootUri(), fileId);
|
2019-04-22 09:41:20 +02:00
|
|
|
return new RedirectResult(url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|