mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
28 lines
750 B
C#
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);
|
|
}
|
|
}
|
|
}
|