btcpayserver/BTCPayServer/Controllers/UIStorageController.cs

28 lines
750 B
C#
Raw Normal View History

using System.Threading.Tasks;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Storage.Services;
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Storage
{
[Route("Storage")]
2022-01-07 04:32:00 +01:00
public class UIStorageController : Controller
{
private readonly FileService _FileService;
2022-01-07 04:32:00 +01:00
public UIStorageController(FileService fileService)
{
_FileService = fileService;
}
[HttpGet("{fileId}")]
public async Task<IActionResult> GetFile(string fileId)
{
var url = await _FileService.GetFileUrl(Request.GetAbsoluteRootUri(), fileId);
2022-05-02 02:43:55 +02:00
if (url is null)
return NotFound();
return new RedirectResult(url);
}
}
}