Include music db files, update link for event files, fix .evt and .cmp static file extension unknown

This commit is contained in:
asesidaa
2023-02-11 00:46:44 +08:00
parent 6eb71437cf
commit aefc9ca326
11 changed files with 78 additions and 32 deletions
+11 -2
View File
@@ -6,6 +6,7 @@ using Infrastructure;
using Infrastructure.Common;
using Infrastructure.Persistence;
using MainServer.Filters;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Serilog;
using Serilog.Extensions.Logging;
@@ -92,8 +93,16 @@ try
app.UseSwaggerUI();
}
// app.UseExceptionHandler();
app.UseStaticFiles();
// Add content type for .cmp and .evt files as static files with unknown file extensions return 404 by default
// See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-7.0#fileextensioncontenttypeprovider
// ReSharper disable once UseObjectOrCollectionInitializer
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".cmp"] = "text/plain";
provider.Mappings[".evt"] = "text/plain";
app.UseStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider
});
app.MapControllers();