修改BUG:ExceptionController Post方法,对Error目录进行列举前未判断目录是否存在
This commit is contained in:
parent
b5cc93338a
commit
fa80df6049
|
@ -1,9 +1,7 @@
|
|||
using Bootstrap.Admin.Query;
|
||||
using Bootstrap.DataAccess;
|
||||
using Longbow.Web.Mvc;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -36,8 +34,9 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
public IEnumerable<string> Post()
|
||||
{
|
||||
var filePath = Path.Combine(AppContext.BaseDirectory, "Error");
|
||||
if (!Directory.Exists(filePath)) return new List<string>();
|
||||
return Directory.GetFiles(filePath)
|
||||
.Where(f => Path.GetExtension(f).Equals(".log", System.StringComparison.OrdinalIgnoreCase))
|
||||
.Where(f => Path.GetExtension(f).Equals(".log", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(f => Path.GetFileNameWithoutExtension(f)).OrderByDescending(s => s);
|
||||
}
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue