|
@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc;
|
|
using Polly;
|
|
using Polly;
|
|
using System.Diagnostics;
|
|
using System.Diagnostics;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
+using Masuit.Tools.AspNetCore.ModelBinder;
|
|
|
|
|
|
namespace Masuit.MyBlogs.Core.Controllers
|
|
namespace Masuit.MyBlogs.Core.Controllers
|
|
{
|
|
{
|
|
@@ -33,13 +34,13 @@ namespace Masuit.MyBlogs.Core.Controllers
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="path"></param>
|
|
/// <param name="path"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public ActionResult GetFiles(string path)
|
|
|
|
|
|
+ public ActionResult GetFiles([FromBodyOrDefault] string path)
|
|
{
|
|
{
|
|
- using var files = Directory.GetFiles(HostEnvironment.WebRootPath + path).OrderByDescending(s => s).Select(s => new
|
|
|
|
|
|
+ var files = Directory.GetFiles(HostEnvironment.WebRootPath + path).OrderByDescending(s => s).Select(s => new
|
|
{
|
|
{
|
|
filename = Path.GetFileName(s),
|
|
filename = Path.GetFileName(s),
|
|
path = s
|
|
path = s
|
|
- }).ToPooledList();
|
|
|
|
|
|
+ });
|
|
return ResultData(files);
|
|
return ResultData(files);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -48,7 +49,7 @@ namespace Masuit.MyBlogs.Core.Controllers
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="filename"></param>
|
|
/// <param name="filename"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public ActionResult Read(string filename)
|
|
|
|
|
|
+ public ActionResult Read([FromBodyOrDefault] string filename)
|
|
{
|
|
{
|
|
if (System.IO.File.Exists(filename))
|
|
if (System.IO.File.Exists(filename))
|
|
{
|
|
{
|
|
@@ -64,7 +65,7 @@ namespace Masuit.MyBlogs.Core.Controllers
|
|
/// <param name="filename"></param>
|
|
/// <param name="filename"></param>
|
|
/// <param name="content"></param>
|
|
/// <param name="content"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public ActionResult Save(string filename, string content)
|
|
|
|
|
|
+ public ActionResult Save([FromBodyOrDefault] string filename, [FromBodyOrDefault] string content)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -83,7 +84,7 @@ namespace Masuit.MyBlogs.Core.Controllers
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[HttpPost]
|
|
- public async Task<ActionResult> Upload(string destination)
|
|
|
|
|
|
+ public async Task<ActionResult> Upload([FromBodyOrDefault] string destination)
|
|
{
|
|
{
|
|
var form = await Request.ReadFormAsync();
|
|
var form = await Request.ReadFormAsync();
|
|
foreach (var t in form.Files)
|
|
foreach (var t in form.Files)
|