Add MIME type mappings for .mjs and .ftl files
Updated the `Program.cs` file to enhance static file handling: - Corrected the comment for `.mjs` MIME type registration. - Added a new MIME type mapping for `.ftl` files as `text/plain`. - Updated `UseStaticFiles` middleware to use a `StaticFileOptions` object with the modified `ContentTypeProvider`. These changes ensure proper serving of `.mjs` and `.ftl` files with appropriate content type headers.
This commit is contained in:
@@ -29,9 +29,10 @@ if (!app.Environment.IsDevelopment())
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
// .mjs MIME-Type für PDF.js registrieren (einmaliger UseStaticFiles-Aufruf)
|
// MIME-Types für PDF.js registrieren (einmaliger UseStaticFiles-Aufruf)
|
||||||
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
|
var provider = new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider();
|
||||||
provider.Mappings[".mjs"] = "text/javascript";
|
provider.Mappings[".mjs"] = "text/javascript";
|
||||||
|
provider.Mappings[".ftl"] = "text/plain";
|
||||||
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
|
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider });
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|||||||
Reference in New Issue
Block a user