feat: add static file serving for APK downloads and new files folder
- Add MIME type mapping for .apk files to allow proper download - Configure static file serving for new "files" directory at /files endpoint - Enable serving APK and other downloadable files from dedicated folder
This commit is contained in:
@@ -127,7 +127,9 @@ void ConfigureStaticFiles(WebApplication app)
|
|||||||
{
|
{
|
||||||
var provider = new FileExtensionContentTypeProvider();
|
var provider = new FileExtensionContentTypeProvider();
|
||||||
provider.Mappings[".amr"] = "audio/amr";
|
provider.Mappings[".amr"] = "audio/amr";
|
||||||
|
provider.Mappings[".apk"] = "application/vnd.android.package-archive";
|
||||||
|
|
||||||
|
// Serve existing My_StaticFiles folder
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
FileProvider = new PhysicalFileProvider(
|
FileProvider = new PhysicalFileProvider(
|
||||||
@@ -135,4 +137,13 @@ void ConfigureStaticFiles(WebApplication app)
|
|||||||
RequestPath = "/My_StaticFiles",
|
RequestPath = "/My_StaticFiles",
|
||||||
ContentTypeProvider = provider
|
ContentTypeProvider = provider
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Serve new files folder for APK and other downloads
|
||||||
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
FileProvider = new PhysicalFileProvider(
|
||||||
|
Path.Combine(app.Environment.ContentRootPath, "files")),
|
||||||
|
RequestPath = "/files",
|
||||||
|
ContentTypeProvider = provider
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user