mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-21 06:04:26 +01:00
Handle exception if log file do not exists.
This commit is contained in:
@@ -666,18 +666,24 @@ namespace BTCPayServer.Controllers
|
||||
if (string.IsNullOrEmpty(file)) return View("Logs", vm);
|
||||
vm.Log = "";
|
||||
var path = Path.Combine(di.FullName, file);
|
||||
|
||||
using (var fileStream = new FileStream(
|
||||
path,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.ReadWrite))
|
||||
try
|
||||
{
|
||||
using (var reader = new StreamReader(fileStream))
|
||||
using (var fileStream = new FileStream(
|
||||
path,
|
||||
FileMode.Open,
|
||||
FileAccess.Read,
|
||||
FileShare.ReadWrite))
|
||||
{
|
||||
vm.Log = await reader.ReadToEndAsync();
|
||||
using (var reader = new StreamReader(fileStream))
|
||||
{
|
||||
vm.Log = await reader.ReadToEndAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
return View("Logs", vm);
|
||||
|
||||
Reference in New Issue
Block a user