Merge branch 'dev' of https://gitea.nxsir.cn/nanxun/ql_apimanager_backend into dev
This commit is contained in:
commit
b6a2afdc66
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.FileProviders;
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using Microsoft.Extensions.FileProviders;
|
||||||
using Serilog.Sinks.MariaDB.Extensions;
|
using Serilog.Sinks.MariaDB.Extensions;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
@ -159,10 +160,15 @@ app.Use(async (context, next) =>
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var uploadsPath = Path.Combine(Directory.GetCurrentDirectory(), "uploads");
|
||||||
|
if (!Directory.Exists(uploadsPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(uploadsPath); // 如果目录不存在,创建它
|
||||||
|
}
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
FileProvider = new PhysicalFileProvider(
|
FileProvider = new PhysicalFileProvider(uploadsPath),
|
||||||
Path.Combine(Directory.GetCurrentDirectory(), "uploads")),
|
|
||||||
RequestPath = "/uploads"
|
RequestPath = "/uploads"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user