mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
d86cc9192e
* wip * Support temporary links for local file system provider * pass base url to file services * fix test * do not crash on errors with local filesystem * remove console * fix paranthesis
30 lines
897 B
C#
30 lines
897 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Configuration;
|
|
using BTCPayServer.Storage.Services;
|
|
using BTCPayServer.Storage.Services.Providers.FileSystemStorage;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BTCPayServer.Storage
|
|
{
|
|
[Route("Storage")]
|
|
public class StorageController : Controller
|
|
{
|
|
private readonly FileService _FileService;
|
|
private string _dir;
|
|
|
|
public StorageController(FileService fileService, BTCPayServerOptions serverOptions)
|
|
{
|
|
_FileService = fileService;
|
|
_dir =FileSystemFileProviderService.GetTempStorageDir(serverOptions);
|
|
}
|
|
|
|
[HttpGet("{fileId}")]
|
|
public async Task<IActionResult> GetFile(string fileId)
|
|
{
|
|
var url = await _FileService.GetFileUrl(Request.GetAbsoluteRootUri(), fileId);
|
|
return new RedirectResult(url);
|
|
}
|
|
}
|
|
}
|