mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Make sure that only the log directory can be read on /server/logs
This commit is contained in:
parent
dde841383a
commit
0e568e2af5
1 changed files with 5 additions and 3 deletions
|
@ -875,14 +875,16 @@ namespace BTCPayServer.Controllers
|
|||
.ToList();
|
||||
vm.LogFileOffset = offset;
|
||||
|
||||
if (string.IsNullOrEmpty(file))
|
||||
if (string.IsNullOrEmpty(file) || !file.EndsWith(fileExtension, StringComparison.Ordinal))
|
||||
return View("Logs", vm);
|
||||
vm.Log = "";
|
||||
var path = Path.Combine(di.FullName, file);
|
||||
var fi = vm.LogFiles.FirstOrDefault(o => o.Name == file);
|
||||
if (fi == null)
|
||||
return NotFound();
|
||||
try
|
||||
{
|
||||
using (var fileStream = new FileStream(
|
||||
path,
|
||||
fi.FullName,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.ReadWrite))
|
||||
|
|
Loading…
Add table
Reference in a new issue