btcpayserver/BTCPayServer/Controllers/UIStorageController.cs
2022-05-02 09:43:55 +09:00

28 lines
750 B
C#

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